mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-13 23:28:53 +01:00
Code review changes.
This commit is contained in:
@ -3,6 +3,11 @@ IO.print(Num.fromString("-123") == -123) // expect: true
|
||||
IO.print(Num.fromString("-0") == -0) // expect: true
|
||||
IO.print(Num.fromString("12.34") == 12.34) // expect: true
|
||||
IO.print(Num.fromString("-0.0001") == -0.0001) // expect: true
|
||||
IO.print(Num.fromString(" 12 ") == 12) // expect: true
|
||||
IO.print(Num.fromString("1.2prefix") == 1.2) // expect: true
|
||||
|
||||
// Test a non-number literal and ensure it returns null.
|
||||
// Test some non-number literals and ensure they return null.
|
||||
IO.print(Num.fromString("test1") == null) // expect: true
|
||||
IO.print(Num.fromString("") == null) // expect: true
|
||||
IO.print(Num.fromString("prefix1.2") == null) // expect: true
|
||||
|
||||
|
||||
1
test/number/from_string_not_string.wren
Normal file
1
test/number/from_string_not_string.wren
Normal file
@ -0,0 +1 @@
|
||||
Num.fromString(1) // expect runtime error: Argument must be a string.
|
||||
Reference in New Issue
Block a user