mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-26 19:21:35 +00:00
Add a debug assert and more tests
This commit is contained in:
15
tests/headless/strings.js
Normal file
15
tests/headless/strings.js
Normal file
@ -0,0 +1,15 @@
|
||||
export function test_string_roundtrip(f) {
|
||||
const test = expected => {
|
||||
const actual = f(expected);
|
||||
if (actual === expected)
|
||||
return;
|
||||
throw new Error(`string roundtrip "${actual}" != "${expected}"`);
|
||||
};
|
||||
|
||||
test('');
|
||||
test('a');
|
||||
test('💖');
|
||||
|
||||
test('a longer string');
|
||||
test('a longer 💖 string');
|
||||
}
|
Reference in New Issue
Block a user