Merge branch 'string-indexof-startindex' of https://github.com/underscorediscovery/wren into underscorediscovery-string-indexof-startindex

This commit is contained in:
Bob Nystrom
2016-08-03 21:51:46 -07:00
4 changed files with 31 additions and 9 deletions
+6
View File
@@ -5,6 +5,12 @@ System.print("abcd".indexOf("abcd")) // expect: 0
System.print("abcd".indexOf("abcde")) // expect: -1
System.print("abab".indexOf("ab")) // expect: 0
System.print("abcd".indexOf("cd", 0)) // expect: 2
System.print("abcd".indexOf("cd", 1)) // expect: 2
System.print("abcd".indexOf("cd", 2)) // expect: 2
System.print("abcd".indexOf("cd", 3)) // expect: -1
System.print("abcd".indexOf("cd", 10)) // expect: -1
// More complex cases.
System.print("abcdefabcdefg".indexOf("defg")) // expect: 9
System.print("abcdabcdabcd".indexOf("dab")) // expect: 3