mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
String.fromCodePoint(). Fix #219.
This commit is contained in:
5
test/core/string/from_code_point.wren
Normal file
5
test/core/string/from_code_point.wren
Normal 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: ╋
|
||||
1
test/core/string/from_code_point_not_int.wren
Normal file
1
test/core/string/from_code_point_not_int.wren
Normal file
@ -0,0 +1 @@
|
||||
IO.print(String.fromCodePoint(12.34)) // expect runtime error: Code point must be an integer.
|
||||
1
test/core/string/from_code_point_not_num.wren
Normal file
1
test/core/string/from_code_point_not_num.wren
Normal file
@ -0,0 +1 @@
|
||||
IO.print(String.fromCodePoint("not num")) // expect runtime error: Code point must be a number.
|
||||
3
test/core/string/from_code_point_too_large.wren
Normal file
3
test/core/string/from_code_point_too_large.wren
Normal 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.
|
||||
1
test/core/string/from_code_point_too_small.wren
Normal file
1
test/core/string/from_code_point_too_small.wren
Normal file
@ -0,0 +1 @@
|
||||
IO.print(String.fromCodePoint(-1)) // expect runtime error: Code point cannot be negative.
|
||||
Reference in New Issue
Block a user