mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Add tests for string methods that support UTF-8 already.
This commit is contained in:
@ -4,3 +4,7 @@ IO.print("something".contains("meth")) // expect: true
|
||||
IO.print("something".contains("some")) // expect: true
|
||||
IO.print("something".contains("ing")) // expect: true
|
||||
IO.print("something".contains("math")) // expect: false
|
||||
|
||||
// Non-ASCII.
|
||||
IO.print("søméthîng".contains("méth")) // expect: true
|
||||
IO.print("søméthîng".contains("meth")) // expect: false
|
||||
|
||||
@ -2,4 +2,8 @@ IO.print("abcd".endsWith("cd")) // expect: true
|
||||
IO.print("abcd".endsWith("abcde")) // expect: false
|
||||
IO.print("abcd".endsWith("abcd")) // expect: true
|
||||
IO.print("abcd".endsWith("f")) // expect: false
|
||||
IO.print("abcd".endsWith("")) // expect: true
|
||||
IO.print("abcd".endsWith("")) // expect: true
|
||||
|
||||
// Non-ASCII.
|
||||
IO.print("søméthîng".endsWith("thîng")) // expect: true
|
||||
IO.print("søméthîng".endsWith("thing")) // expect: false
|
||||
@ -17,3 +17,7 @@ IO.print("" != "abcd") // expect: true
|
||||
// Not equal to other types.
|
||||
IO.print("1" != 1) // expect: true
|
||||
IO.print("true" != true) // expect: true
|
||||
|
||||
// Non-ASCII.
|
||||
IO.print("vålue" == "value") // expect: false
|
||||
IO.print("vålue" == "vålue") // expect: true
|
||||
|
||||
@ -2,3 +2,8 @@ IO.print("abcd".indexOf("cd")) // expect: 2
|
||||
IO.print("abcd".indexOf("a")) // expect: 0
|
||||
IO.print("abcd".indexOf("abcde")) // expect: -1
|
||||
IO.print("abab".indexOf("ab")) // expect: 0
|
||||
|
||||
// Non-ASCII. Note that it returns byte indices, not code points.
|
||||
IO.print("søméஃthîng".indexOf("e")) // expect: -1
|
||||
IO.print("søméஃthîng".indexOf("m")) // expect: 3
|
||||
IO.print("søméஃthîng".indexOf("thî")) // expect: 9
|
||||
|
||||
@ -3,3 +3,7 @@ IO.print("abcd".startsWith("a")) // expect: true
|
||||
IO.print("abcd".startsWith("abcd")) // expect: true
|
||||
IO.print("abcd".startsWith("abcde")) // expect: false
|
||||
IO.print("abcd".startsWith("")) // expect: true
|
||||
|
||||
// Non-ASCII.
|
||||
IO.print("søméthîng".startsWith("sømé")) // expect: true
|
||||
IO.print("søméthîng".startsWith("some")) // expect: false
|
||||
|
||||
Reference in New Issue
Block a user