Adjust JS backend to CharSequence.length transformation

This commit is contained in:
Denis Zharkov
2015-10-11 21:48:21 +03:00
committed by Mikhail Glukhikh
parent 1305d9755a
commit cb562e7ea5
2 changed files with 5 additions and 7 deletions
+4 -4
View File
@@ -345,7 +345,7 @@ class StringTest {
val s = "sample"
assertEquals(listOf(s.indices), s.rangesDelimitedBy("-").toList())
assertEquals(listOf(s.indices), s.rangesDelimitedBy("-", startIndex = -1).toList())
assertTrue(s.rangesDelimitedBy("-", startIndex = s.length()).single().isEmpty())
assertTrue(s.rangesDelimitedBy("-", startIndex = s.length).single().isEmpty())
}
*/
@@ -470,7 +470,7 @@ class StringTest {
assertEquals(4, string.lastIndexOf('e'))
assertEquals(2, string.lastIndexOf('e', 3))
for (startIndex in -1..string.length()+1) {
for (startIndex in -1..string.length+1) {
assertEquals(string.indexOfAny(charArrayOf('e'), startIndex), string.indexOf('e', startIndex))
assertEquals(string.lastIndexOfAny(charArrayOf('e'), startIndex), string.lastIndexOf('e', startIndex))
}
@@ -487,7 +487,7 @@ class StringTest {
assertEquals(2, string.lastIndexOf('e', 3, ignoreCase = true))
for (startIndex in -1..string.length()+1){
for (startIndex in -1..string.length+1){
assertEquals(string.indexOfAny(charArrayOf('e'), startIndex, ignoreCase = true), string.indexOf('E', startIndex, ignoreCase = true))
assertEquals(string.lastIndexOfAny(charArrayOf('E'), startIndex, ignoreCase = true), string.lastIndexOf('e', startIndex, ignoreCase = true))
}
@@ -664,7 +664,7 @@ ${" "}
""".trimIndent()
assertEquals(23, deindented.lines().size())
val indents = deindented.lines().map { "^\\s*".toRegex().match(it)!!.value.length() }
val indents = deindented.lines().map { "^\\s*".toRegex().match(it)!!.value.size }
assertEquals(0, indents.min())
assertEquals(42, indents.max())
assertEquals(1, deindented.lines().count { it.isEmpty() })