Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 369c6fc

Browse files
authoredFeb 17, 2021
Add missing tests for String#codePointAt, concat and fromCharCodes (#1686)
1 parent 6fe4b28 commit 369c6fc

File tree

3 files changed

+6359
-5466
lines changed

3 files changed

+6359
-5466
lines changed
 

‎tests/compiler/std/string.optimized.wat‎

Lines changed: 3745 additions & 3332 deletions
Large diffs are not rendered by default.

‎tests/compiler/std/string.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ assert("\xDFab" == "ßab");
1313

1414
assert(str.length == 16);
1515
assert(str.charCodeAt(0) == 0x68);
16+
assert(str.codePointAt(1) == 105);
1617
assert(str.at(15) == str.charAt(15));
1718
assert(str.at(-1) == str.charAt(str.length - 1));
1819
assert(str.at(-str.length) == "h");
@@ -22,9 +23,13 @@ assert(!!"\0" == true);
2223
assert(!!"a" == true);
2324

2425
assert(String.fromCharCode(0) == "\0");
26+
assert(String.fromCharCode(65600) == "@");
2527
assert(String.fromCharCode(54) == "6");
2628
assert(String.fromCharCode(0x10000 + 54) == "6");
2729
assert(String.fromCharCode(0xD800, 0xDF00) == "𐌀");
30+
assert(String.fromCharCodes([0, 54]) == "\06");
31+
assert(String.fromCharCodes([65, 66, 67]) == "ABC");
32+
assert(String.fromCharCodes([0xD834, 0xDF06, 0x61, 0xD834, 0xDF07]) == "\uD834\uDF06a\uD834\uDF07");
2833

2934
assert(String.fromCodePoint(0) == "\0");
3035
assert(String.fromCodePoint(54) == "6");
@@ -770,6 +775,14 @@ assert(dtoa(1.1e+128) == "1.1e+128");
770775
assert(dtoa(1.1e-64) == "1.1e-64");
771776
assert(dtoa(0.000035689) == "0.000035689");
772777

778+
779+
// concat
780+
781+
assert("Hello ".concat("World") == "Hello World");
782+
assert("".concat("bar") == "bar");
783+
assert("bar".concat("") == "bar");
784+
assert("".concat("") == "");
785+
773786
// assert(dtoa(f32.MAX_VALUE) == "3.4028234663852886e+38"); // FIXME
774787
// assert(dtoa(f32.EPSILON) == "1.1920928955078125e-7"); // FIXME
775788

‎tests/compiler/std/string.untouched.wat‎

Lines changed: 2601 additions & 2134 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.