KJS: remove deprecated splitWithRegex and it's implementation in kotlin_lib.js
This commit is contained in:
@@ -14,14 +14,6 @@ internal inline fun String.nativeStartsWith(s: String, position: Int): Boolean =
|
||||
|
||||
internal inline fun String.nativeEndsWith(s: String): Boolean = asDynamic().endsWith(s)
|
||||
|
||||
@Deprecated("Use split(Regex) instead.", ReplaceWith("split(regex.toRegex()).toTypedArray()"))
|
||||
@library("splitString")
|
||||
public fun String.splitWithRegex(regex: String): Array<String> = noImpl
|
||||
|
||||
@Deprecated("Use split(Regex) instead.", ReplaceWith("split(regex.toRegex(), limit = limit).toTypedArray()"))
|
||||
@library("splitString")
|
||||
public fun String.splitWithRegex(regex: String, limit: Int): Array<String> = noImpl
|
||||
|
||||
public inline fun String.substring(startIndex: Int): String = asDynamic().substring(startIndex)
|
||||
|
||||
public inline fun String.substring(startIndex: Int, endIndex: Int): String = asDynamic().substring(startIndex, endIndex)
|
||||
|
||||
@@ -278,10 +278,6 @@ Kotlin.primitiveArraySort = function(array) {
|
||||
array.sort(Kotlin.primitiveCompareTo)
|
||||
};
|
||||
|
||||
Kotlin.splitString = function (str, regex, limit) {
|
||||
return str.split(new RegExp(regex), limit);
|
||||
};
|
||||
|
||||
Kotlin.nullArray = function (size) {
|
||||
var res = [];
|
||||
var i = size;
|
||||
|
||||
@@ -2941,12 +2941,6 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("stringSplit.kt")
|
||||
public void testStringSplit() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/expression/stringClass/stringSplit.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("subSequence.kt")
|
||||
public void testSubSequence() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/expression/stringClass/subSequence.kt");
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val testInput = "test data\t1foo 2 bar"
|
||||
val tests = arrayOf(
|
||||
" " to arrayOf("test", "data\t1foo", "", "2", "bar"),
|
||||
"\\s+" to arrayOf("test", "data", "1foo", "2", "bar"),
|
||||
"[sd]" to arrayOf("te", "t ", "ata\t1foo 2 bar"),
|
||||
"[\\d]" to arrayOf("test data\t", "foo ", " bar")
|
||||
)
|
||||
|
||||
for (test in tests) {
|
||||
val regexp = test.first
|
||||
val expected = test.second
|
||||
val result = testInput.splitWithRegex(regexp)
|
||||
|
||||
if (result.asList() != expected.asList()) return "Wrong result for '$regexp' -- Expected: $expected | Actual: $result"
|
||||
}
|
||||
|
||||
for (test in tests) {
|
||||
val regexp = test.first
|
||||
val limit = 2
|
||||
val expected = Array(limit) { test.second[it] }
|
||||
val result = testInput.splitWithRegex(regexp, limit)
|
||||
|
||||
if (result.asList() != expected.asList()) return "Wrong result for '$regexp' -- Expected: $expected | Actual: $result"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user