summaryrefslogtreecommitdiffstats
path: root/vendor/wasm-bindgen/tests/headless/strings.js
blob: 866bad653a14454d7b8809c35a65ed0c1b5c1bc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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');

  test('\uFEFFbar');
}

export function identity(s) {
  return s;
}