diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/embind/embind.test.js | 8 | ||||
-rw-r--r-- | tests/embind/embind_test.cpp | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js index 4a8665f4..07f093ea 100755 --- a/tests/embind/embind.test.js +++ b/tests/embind/embind.test.js @@ -388,6 +388,14 @@ module({ }); }); + BaseFixture.extend("string", function() { + var expected = ''; + for (var i = 0; i < 128; ++i) { + expected += String.fromCharCode(128 + i); + } + assert.equal(expected, cm.get_non_ascii_string()); + }); + BaseFixture.extend("embind", function() { test("value creation", function() { assert.equal(15, cm.emval_test_new_integer()); diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp index 39de3852..6a3d5dba 100644 --- a/tests/embind/embind_test.cpp +++ b/tests/embind/embind_test.cpp @@ -79,6 +79,15 @@ unsigned emval_test_sum(val v) { return rv;
}
+std::string get_non_ascii_string() {
+ char c[128 + 1];
+ c[128] = 0;
+ for (int i = 0; i < 128; ++i) {
+ c[i] = 128 + i;
+ }
+ return c;
+}
+
std::string emval_test_take_and_return_const_char_star(const char* str) {
return str;
}
@@ -1493,6 +1502,7 @@ EMSCRIPTEN_BINDINGS(tests) { function("const_ref_adder", &const_ref_adder);
function("emval_test_sum", &emval_test_sum);
+ function("get_non_ascii_string", &get_non_ascii_string);
//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);
|