wasm-bindgen/tests/headless/strings.js
Pauan fb0bbc00cb Adding ignoreBOM and fatal to TextDecoder (#1730)
* Adding ignoreBOM and fatal to TextDecoder

* Minor tweak to expose_text_processor

* Adding in unit tests for BOM

* Adding in comment for expose_text_decoder

* Attempting to fix build failure

* Temporarily disabling unit tests
2019-08-22 20:00:49 -07:00

23 lines
448 B
JavaScript

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');
// TODO re-enable this when Firefox 70 is released
//test('\uFEFFbar');
}
export function identity(s) {
return s;
}