.cargo/vendor/wasm-bindgen/tests/headless/strings.js
raw| 1 | export function test_string_roundtrip(f) { |
| 2 | const test = expected => { |
| 3 | const actual = f(expected); |
| 4 | if (actual === expected) |
| 5 | return; |
| 6 | throw new Error(`string roundtrip "${actual}" != "${expected}"`); |
| 7 | }; |
| 8 | |
| 9 | test(''); |
| 10 | test('a'); |
| 11 | test('💖'); |
| 12 | |
| 13 | test('a longer string'); |
| 14 | test('a longer 💖 string'); |
| 15 | |
| 16 | test('\uFEFFbar'); |
| 17 | } |
| 18 | |
| 19 | export function identity(s) { |
| 20 | return s; |
| 21 | } |