String.fromCodePoint(). Fix #219.

This commit is contained in:
Bob Nystrom
2015-03-27 07:43:36 -07:00
parent 373770a8d5
commit 7d45dda383
23 changed files with 166 additions and 43 deletions

View File

@ -0,0 +1,5 @@
IO.print(String.fromCodePoint(65)) // expect: A
IO.print(String.fromCodePoint(164)) // expect: ¤
IO.print(String.fromCodePoint(398)) // expect: Ǝ
IO.print(String.fromCodePoint(8225)) // expect: ‡
IO.print(String.fromCodePoint(0x254b)) // expect: ╋

View File

@ -0,0 +1 @@
IO.print(String.fromCodePoint(12.34)) // expect runtime error: Code point must be an integer.

View File

@ -0,0 +1 @@
IO.print(String.fromCodePoint("not num")) // expect runtime error: Code point must be a number.

View File

@ -0,0 +1,3 @@
// UTF-8 mandates that only values up to 10ffff can be encoded.
// See: http://tools.ietf.org/html/rfc3629
IO.print(String.fromCodePoint(0x10ffff + 1)) // expect runtime error: Code point cannot be greater than 0x10ffff.

View File

@ -0,0 +1 @@
IO.print(String.fromCodePoint(-1)) // expect runtime error: Code point cannot be negative.