aboutsummaryrefslogtreecommitdiff
path: root/tests/embind/embind_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/embind/embind_test.cpp')
-rw-r--r--tests/embind/embind_test.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp
index e8ca0338..72506346 100644
--- a/tests/embind/embind_test.cpp
+++ b/tests/embind/embind_test.cpp
@@ -1084,6 +1084,7 @@ public:
return "optional" + s;
}
+ virtual std::shared_ptr<Derived> returnsSharedPtr() = 0;
virtual void differentArguments(int i, double d, unsigned char f, double q, std::string) = 0;
};
@@ -1103,6 +1104,10 @@ public:
}, s);
}
+ std::shared_ptr<Derived> returnsSharedPtr() {
+ return call<std::shared_ptr<Derived> >("returnsSharedPtr");
+ }
+
void differentArguments(int i, double d, unsigned char f, double q, std::string s) {
return call<void>("differentArguments", i, d, f, q, s);
}
@@ -1116,6 +1121,10 @@ class ConcreteClass : public AbstractClass {
void differentArguments(int i, double d, unsigned char f, double q, std::string s) {
}
+
+ std::shared_ptr<Derived> returnsSharedPtr() {
+ return std::shared_ptr<Derived>();
+ }
};
std::shared_ptr<AbstractClass> getAbstractClass() {
@@ -1130,6 +1139,11 @@ std::string callOptionalMethod(AbstractClass& ac, std::string s) {
return ac.optionalMethod(s);
}
+void callReturnsSharedPtrMethod(AbstractClass& ac) {
+ std::shared_ptr<Derived> sp = ac.returnsSharedPtr();
+ // unused: sp
+}
+
void callDifferentArguments(AbstractClass& ac, int i, double d, unsigned char f, double q, std::string s) {
return ac.differentArguments(i, d, f, q, s);
}
@@ -1145,6 +1159,7 @@ EMSCRIPTEN_BINDINGS(interface_tests) {
function("getAbstractClass", &getAbstractClass);
function("callAbstractMethod", &callAbstractMethod);
function("callOptionalMethod", &callOptionalMethod);
+ function("callReturnsSharedPtrMethod", &callReturnsSharedPtrMethod);
function("callDifferentArguments", &callDifferentArguments);
}