aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndy Friesen <andy@imvu.com>2013-01-31 10:10:49 -0800
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:23:47 +0300
commit3b6ea45565ae17f32d77933b505a6ccfe7a8967f (patch)
tree19c81bafb8888a9c7f43cb5deb2a7fade6b3d724 /tests
parent5b3d12c90558f0472c374349c5a4cdce474832a4 (diff)
emscripten::internal::optional is now copyable.
Fix JSInterface::JSInterface copy constructor to take a const&
Diffstat (limited to 'tests')
-rw-r--r--tests/embind/embind_test.cpp21
-rw-r--r--tests/embind/embind_test.js5
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp
index dc052d1a..485cdfcd 100644
--- a/tests/embind/embind_test.cpp
+++ b/tests/embind/embind_test.cpp
@@ -233,6 +233,24 @@ void emval_test_call_function(val v, int i, float f, TupleVector tv, StructVecto
v(i, f, tv, sv);
}
+void optional_test_copy() {
+ using emscripten::internal::optional;
+
+ optional<int> foo = 22;
+ optional<int> bar(foo);
+
+ return bool(bar);
+}
+
+void optional_test_copy2() {
+ using emscripten::internal::optional;
+
+ optional<int> foo;
+ optional<int> bar(foo);
+
+ return bool(bar);
+}
+
EMSCRIPTEN_BINDINGS(([]() {
function("mallinfo", &emval_test_mallinfo);
@@ -337,4 +355,7 @@ EMSCRIPTEN_BINDINGS(([]() {
function("emval_test_call_method3", &emval_test_call_method3);
function("emval_test_call_function", &emval_test_call_function);
+
+ function('optional_test_copy', &optional_test_copy);
+ function('optional_test_copy2', &optional_test_copy2);
}));
diff --git a/tests/embind/embind_test.js b/tests/embind/embind_test.js
index 8c61553b..9ba6a48f 100644
--- a/tests/embind/embind_test.js
+++ b/tests/embind/embind_test.js
@@ -390,4 +390,9 @@ module({
assert.deepEqual(['called'], calls);
},
});
+
+ test('emscripten::internal::optional', function () {
+ assert.true(cm.optional_test_copy());
+ assert.false(cm.optional_test_copy2());
+ });
});