aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/embind/embind.test.js8
-rw-r--r--tests/embind/embind_test.cpp5
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js
index 872ee398..6f63d543 100755
--- a/tests/embind/embind.test.js
+++ b/tests/embind/embind.test.js
@@ -404,6 +404,14 @@ module({
String.fromCharCode(65535);
assert.equal(expected, cm.get_non_ascii_wstring());
});
+
+ test("passing unicode string into C++", function() {
+ var expected = String.fromCharCode(10) +
+ String.fromCharCode(1234) +
+ String.fromCharCode(2345) +
+ String.fromCharCode(65535);
+ assert.equal(expected, cm.take_and_return_std_wstring(expected));
+ });
});
BaseFixture.extend("embind", function() {
diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp
index f274fbf5..86d850e0 100644
--- a/tests/embind/embind_test.cpp
+++ b/tests/embind/embind_test.cpp
@@ -109,6 +109,10 @@ std::string emval_test_take_and_return_std_string_const_ref(const std::string& s
return str;
}
+std::wstring take_and_return_std_wstring(std::wstring str) {
+ return str;
+}
+
std::function<std::string (std::string)> emval_test_get_function_ptr() {
return emval_test_take_and_return_std_string;
}
@@ -1516,6 +1520,7 @@ EMSCRIPTEN_BINDINGS(tests) {
//function("emval_test_take_and_return_const_char_star", &emval_test_take_and_return_const_char_star);
function("emval_test_take_and_return_std_string", &emval_test_take_and_return_std_string);
function("emval_test_take_and_return_std_string_const_ref", &emval_test_take_and_return_std_string_const_ref);
+ function("take_and_return_std_wstring", &take_and_return_std_wstring);
//function("emval_test_take_and_return_CustomStruct", &emval_test_take_and_return_CustomStruct);