Add String.fromCodePoint and 16-bit string compare (#174)

This commit is contained in:
Max Graey
2018-07-23 15:32:55 +03:00
committed by Daniel Wirtz
parent 1ecf85bf7c
commit 298a8f1688
15 changed files with 3188 additions and 3191 deletions

View File

@ -12,6 +12,15 @@ assert(changetype<usize>(str) == changetype<usize>("hi, I'm a string"));
assert(str.length == 16);
assert(str.charCodeAt(0) == 0x68);
assert(String.fromCharCode(0) == "\0");
assert(String.fromCharCode(54) == "6");
assert(String.fromCharCode(0x10000 + 54) == "6");
assert(String.fromCodePoint(0) == "\0");
assert(String.fromCodePoint(54) == "6");
assert(String.fromCodePoint(0x1D306), "\uD834\uDF06");
assert(str.startsWith("hi"));
assert(str.endsWith("string"));
assert(str.includes("I'm"));
@ -82,6 +91,10 @@ assert(!("" > ""));
assert("" >= "");
assert("" <= "");
var a = String.fromCodePoint(0xFF61);
var b = String.fromCodePoint(0xD800) + String.fromCodePoint(0xDC02);
assert(a > b);
assert("123".length == 3);
assert("".repeat(100) == "");