Fix deprecations in js and java tests.
This commit is contained in:
@@ -56,12 +56,12 @@ class RegExpTest {
|
|||||||
val string = "R2D2 beats A5D5 "
|
val string = "R2D2 beats A5D5 "
|
||||||
var re = RegExp("""(\w\d)(\w\d)""", "g")
|
var re = RegExp("""(\w\d)(\w\d)""", "g")
|
||||||
val m1 = re.exec(string)!!
|
val m1 = re.exec(string)!!
|
||||||
assertEquals(array("R2D2", "R2", "D2"), m1)
|
assertEquals(arrayOf("R2D2", "R2", "D2"), m1)
|
||||||
assertEquals(0, (m1 as RegExpMatch).index)
|
assertEquals(0, (m1 as RegExpMatch).index)
|
||||||
assertEquals(4, re.lastIndex)
|
assertEquals(4, re.lastIndex)
|
||||||
|
|
||||||
val m2 = re.exec(string)!!
|
val m2 = re.exec(string)!!
|
||||||
assertEquals(array("A5D5", "A5", "D5"), m2)
|
assertEquals(arrayOf("A5D5", "A5", "D5"), m2)
|
||||||
assertEquals(string.indexOf(m2[0]!!), (m2 as RegExpMatch).index)
|
assertEquals(string.indexOf(m2[0]!!), (m2 as RegExpMatch).index)
|
||||||
|
|
||||||
val noMatch = re.exec(string)
|
val noMatch = re.exec(string)
|
||||||
|
|||||||
+3
-4
@@ -7,7 +7,6 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static kotlin.KotlinPackage.*;
|
import static kotlin.KotlinPackage.*;
|
||||||
import static kotlin.util.UtilPackage.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lets try using the Kotlin standard library from Java code
|
* Lets try using the Kotlin standard library from Java code
|
||||||
@@ -15,9 +14,9 @@ import static kotlin.util.UtilPackage.*;
|
|||||||
public class CollectionTest extends TestCase {
|
public class CollectionTest extends TestCase {
|
||||||
|
|
||||||
public void testCollections() throws Exception {
|
public void testCollections() throws Exception {
|
||||||
List<String> list = arrayList("foo", "bar");
|
List<String> list = arrayListOf("foo", "bar");
|
||||||
|
|
||||||
String text = makeString(list, ",", "(", ")", -1, "...");
|
String text = joinToString(list, ",", "(", ")", -1, "...", null);
|
||||||
System.out.println("Have text: " + text);
|
System.out.println("Have text: " + text);
|
||||||
assertEquals("(foo,bar)", text);
|
assertEquals("(foo,bar)", text);
|
||||||
|
|
||||||
@@ -29,6 +28,6 @@ public class CollectionTest extends TestCase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
System.out.println("Filtered list is " + actual);
|
System.out.println("Filtered list is " + actual);
|
||||||
assertEquals("(bar)", makeString(actual, ",", "(", ")", -1, "..."));
|
assertEquals("(bar)", joinToString(actual, ",", "(", ")", -1, "...", null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user