blob: dc4e3c8c4a57b64ab390fefb740bd5e7bd73dc20 [file] [log] [blame]
ysuzuki@apple.comb064c652019-09-11 22:36:52 +00001function shouldBe(actual, expected) {
2 if (actual !== expected)
3 throw new Error('bad value: ' + actual);
4}
5
6function test(string) {
7 return string.codePointAt(0);
8}
9noInline(test);
10
11function breaking(string) {
12 return string.codePointAt(1);
13}
14noInline(breaking);
15
16var string = "𠮷野家";
17shouldBe(string.length, 4);
18for (var i = 0; i < 1e6; ++i) {
19 shouldBe(test(string), 0x20bb7);
20 shouldBe(test("𠮷"), 0x20bb7);
21 shouldBe(breaking(string), 0xdfb7);
22}