Fix endsWith in JS always ignored character case, regardless of the ignoreCase parameter value.

startsWith, endsWith again use native implementation when possible.
This commit is contained in:
Ilya Gorbunov
2015-04-01 17:15:01 +03:00
parent 315badd5d1
commit cac058d5a3
3 changed files with 32 additions and 6 deletions
+4
View File
@@ -39,6 +39,7 @@ class StringTest {
assertTrue("some".startsWith(""))
assertTrue("".startsWith(""))
assertFalse("abcd".startsWith("aB", ignoreCase = false))
assertTrue("abcd".startsWith("aB", ignoreCase = true))
}
@@ -46,6 +47,7 @@ class StringTest {
assertTrue("abcd".endsWith("d"))
assertTrue("abcd".endsWith("abcd"))
assertFalse("abcd".endsWith("b"))
assertFalse("strö".endsWith("", ignoreCase = false))
assertTrue("strö".endsWith("", ignoreCase = true))
assertFalse("".endsWith("a"))
assertTrue("some".endsWith(""))
@@ -55,6 +57,7 @@ class StringTest {
test fun startsWithChar() {
assertTrue("abcd".startsWith('a'))
assertFalse("abcd".startsWith('b'))
assertFalse("abcd".startsWith('A', ignoreCase = false))
assertTrue("abcd".startsWith('A', ignoreCase = true))
assertFalse("".startsWith('a'))
}
@@ -62,6 +65,7 @@ class StringTest {
test fun endsWithChar() {
assertTrue("abcd".endsWith('d'))
assertFalse("abcd".endsWith('b'))
assertFalse("strö".endsWith('Ö', ignoreCase = false))
assertTrue("strö".endsWith('Ö', ignoreCase = true))
assertFalse("".endsWith('a'))
}