Skip to content

Commit 8a9868b

Browse files
committed
Add test for return_value_policy
1 parent 91e849b commit 8a9868b

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

robotpy_build/autowrap/cxxparser.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ def _gen_int_types():
113113

114114

115115
_rvp_map = {
116-
ReturnValuePolicy.TAKE_OWNERSHIP: ", py::return_value_policy::take_ownership",
117-
ReturnValuePolicy.COPY: ", py::return_value_policy::copy",
118-
ReturnValuePolicy.MOVE: ", py::return_value_policy::move",
119-
ReturnValuePolicy.REFERENCE: ", py::return_value_policy::reference",
120-
ReturnValuePolicy.REFERENCE_INTERNAL: ", py::return_value_policy::reference_internal",
116+
ReturnValuePolicy.TAKE_OWNERSHIP: "py::return_value_policy::take_ownership",
117+
ReturnValuePolicy.COPY: "py::return_value_policy::copy",
118+
ReturnValuePolicy.MOVE: "py::return_value_policy::move",
119+
ReturnValuePolicy.REFERENCE: "py::return_value_policy::reference",
120+
ReturnValuePolicy.REFERENCE_INTERNAL: "py::return_value_policy::reference_internal",
121121
ReturnValuePolicy.AUTOMATIC: "",
122-
ReturnValuePolicy.AUTOMATIC_REFERENCE: ", py::return_value_policy::automatic_reference",
122+
ReturnValuePolicy.AUTOMATIC_REFERENCE: "py::return_value_policy::automatic_reference",
123123
}
124124

125125
# fmt: off

tests/cpp/gen/ft/nested.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ classes:
22
OuterNested:
33
methods:
44
OuterNested:
5+
getInner:
6+
return_value_policy: reference_internal
57
OuterNested::InnerNested:
68
methods:
79
fn:

tests/cpp/rpytest/ft/include/nested.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ struct OuterNested {
1414
// bug where InnerNested needs to be in binding scope
1515
OuterNested(std::vector<InnerNested> i) {}
1616

17+
InnerNested &getInner() {
18+
return in;
19+
}
20+
1721
private:
1822

1923
// lol bug
2024
struct InnerPrivate {};
21-
25+
26+
InnerNested in;
2227
};

0 commit comments

Comments
 (0)