forked from Mirror/wren
Adds some common methods to strings.
This commit is contained in:
5
test/string/endsWith.wren
Normal file
5
test/string/endsWith.wren
Normal file
@ -0,0 +1,5 @@
|
||||
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
|
||||
1
test/string/endsWith_invalid_arg.wren
Normal file
1
test/string/endsWith_invalid_arg.wren
Normal file
@ -0,0 +1 @@
|
||||
IO.print("abcd".endsWith(null)) // expect runtime error: Argument must be a string.
|
||||
4
test/string/indexOf.wren
Normal file
4
test/string/indexOf.wren
Normal file
@ -0,0 +1,4 @@
|
||||
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
|
||||
1
test/string/indexOf_invalid_arg.wren
Normal file
1
test/string/indexOf_invalid_arg.wren
Normal file
@ -0,0 +1 @@
|
||||
IO.print("abcd".indexOf(null)) // expect runtime error: Argument must be a string.
|
||||
5
test/string/startsWith.wren
Normal file
5
test/string/startsWith.wren
Normal file
@ -0,0 +1,5 @@
|
||||
IO.print("abcd".startsWith("cd")) // expect: false
|
||||
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
|
||||
1
test/string/startsWith_invalid_arg.wren
Normal file
1
test/string/startsWith_invalid_arg.wren
Normal file
@ -0,0 +1 @@
|
||||
IO.print("abcd".startsWith(null)) // expect runtime error: Argument must be a string.
|
||||
Reference in New Issue
Block a user