mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-10 21:58:48 +01:00
Added String.fromByte with docs and unit test
This commit is contained in:
3
test/core/string/from_byte.wren
Normal file
3
test/core/string/from_byte.wren
Normal file
@ -0,0 +1,3 @@
|
||||
System.print(String.fromByte(65)) // expect: A
|
||||
System.print(String.fromByte(0).bytes[0]) // expect: 0
|
||||
System.print(String.fromByte(255).bytes[0]) // expect: 255
|
||||
1
test/core/string/from_byte_not_int.wren
Normal file
1
test/core/string/from_byte_not_int.wren
Normal file
@ -0,0 +1 @@
|
||||
System.print(String.fromByte(12.34)) // expect runtime error: Byte must be an integer.
|
||||
1
test/core/string/from_byte_not_num.wren
Normal file
1
test/core/string/from_byte_not_num.wren
Normal file
@ -0,0 +1 @@
|
||||
System.print(String.fromByte("not num")) // expect runtime error: Byte must be a number.
|
||||
1
test/core/string/from_byte_too_large.wren
Normal file
1
test/core/string/from_byte_too_large.wren
Normal file
@ -0,0 +1 @@
|
||||
System.print(String.fromByte(0xff + 1)) // expect runtime error: Byte cannot be greater than 0xff.
|
||||
1
test/core/string/from_byte_too_small.wren
Normal file
1
test/core/string/from_byte_too_small.wren
Normal file
@ -0,0 +1 @@
|
||||
System.print(String.fromByte(-1)) // expect runtime error: Byte cannot be negative.
|
||||
Reference in New Issue
Block a user