Merge remote branch 'origin/master'
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
import std.*
|
|
||||||
import std.io.*
|
|
||||||
|
|
||||||
import java.io.*
|
|
||||||
|
|
||||||
fun box() : String {
|
|
||||||
val x = ByteArray (10)
|
|
||||||
|
|
||||||
for(index in 0..9) {
|
|
||||||
x [index] = index.byt
|
|
||||||
}
|
|
||||||
|
|
||||||
for(b in x.inputStream) {
|
|
||||||
System.out?.println(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
@@ -50,11 +50,6 @@ public class StdlibTest extends CodegenTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInputStreamIterator () {
|
|
||||||
blackBoxFile("inputStreamIterator.jet");
|
|
||||||
// System.out.println(generateToText());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testKt533 () {
|
public void testKt533 () {
|
||||||
blackBoxFile("regressions/kt533.kt");
|
blackBoxFile("regressions/kt533.kt");
|
||||||
}
|
}
|
||||||
@@ -74,16 +69,4 @@ public class StdlibTest extends CodegenTestCase {
|
|||||||
public void testKt828 () {
|
public void testKt828 () {
|
||||||
blackBoxFile("regressions/kt828.kt");
|
blackBoxFile("regressions/kt828.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCollectionSize () throws Exception {
|
|
||||||
loadText("import std.util.*; fun box() = if(java.util.Arrays.asList(0, 1, 2)?.size == 3) \"OK\" else \"fail\"");
|
|
||||||
// System.out.println(generateToText());
|
|
||||||
blackBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testCollectionEmpty () throws Exception {
|
|
||||||
loadText("import std.util.*; fun box() = if(java.util.Arrays.asList(0, 1, 2)?.empty ?: false) \"OK\" else \"fail\"");
|
|
||||||
// System.out.println(generateToText());
|
|
||||||
blackBox();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,8 @@ import java.io.*
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class IoTest() : TestSupport() {
|
class IoTest() : TestSupport() {
|
||||||
val file = File("test/HelloWorld.txt")
|
|
||||||
|
|
||||||
fun testLineIteratorWithManualClose() {
|
fun testLineIteratorWithManualClose() {
|
||||||
val reader = FileReader(file).buffered()
|
val reader = sample().buffered()
|
||||||
try {
|
try {
|
||||||
val list = reader.lineIterator().toArrayList()
|
val list = reader.lineIterator().toArrayList()
|
||||||
assertEquals(arrayList("Hello", "World"), list)
|
assertEquals(arrayList("Hello", "World"), list)
|
||||||
@@ -19,14 +17,17 @@ class IoTest() : TestSupport() {
|
|||||||
reader.close()
|
reader.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun sample() : Reader {
|
||||||
|
return InputStreamReader((this as java.lang.Object).getClass()?.getClassLoader()?.getResourceAsStream("test/HelloWorld.txt"))
|
||||||
|
}
|
||||||
|
|
||||||
fun testLineIterator() {
|
fun testLineIterator() {
|
||||||
/*
|
/*
|
||||||
// TODO compiler error
|
// TODO compiler error
|
||||||
// both these expressions causes java.lang.NoClassDefFoundError: collections/namespace
|
// both these expressions causes java.lang.NoClassDefFoundError: collections/namespace
|
||||||
val list = FileReader(file).useLines{it.toArrayList()}
|
val list = sample().useLines{it.toArrayList()}
|
||||||
val list = FileReader(file).useLines<ArrayList<String>>{it.toArrayList()}
|
val list = sample().useLines<ArrayList<String>>{it.toArrayList()}
|
||||||
|
|
||||||
assertEquals(arrayList("Hello", "World"), list)
|
assertEquals(arrayList("Hello", "World"), list)
|
||||||
*/
|
*/
|
||||||
@@ -35,7 +36,7 @@ class IoTest() : TestSupport() {
|
|||||||
fun testUse() {
|
fun testUse() {
|
||||||
/**
|
/**
|
||||||
val list = ArrayList<String>()
|
val list = ArrayList<String>()
|
||||||
val reader = FileReader(file).buffered()
|
val reader = sample().buffered()
|
||||||
|
|
||||||
TODO compiler error?
|
TODO compiler error?
|
||||||
reader.use{
|
reader.use{
|
||||||
@@ -48,4 +49,4 @@ class IoTest() : TestSupport() {
|
|||||||
assertEquals(arrayList("Hello", "World"), list)
|
assertEquals(arrayList("Hello", "World"), list)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package test.collections
|
||||||
|
|
||||||
|
import std.*
|
||||||
|
import std.io.*
|
||||||
|
import std.util.*
|
||||||
|
import std.test.*
|
||||||
|
import java.util.*
|
||||||
|
import java.io.*
|
||||||
|
|
||||||
|
class OldStdlibTest() : TestSupport() {
|
||||||
|
fun testCollectionEmpty() {
|
||||||
|
assertNot {
|
||||||
|
Arrays.asList(0, 1, 2)?.empty ?: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testCollectionSize() {
|
||||||
|
assert {
|
||||||
|
Arrays.asList(0, 1, 2)?.size == 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testInputStreamIterator() {
|
||||||
|
val x = ByteArray (10)
|
||||||
|
|
||||||
|
for(index in 0..9) {
|
||||||
|
x [index] = index.byt
|
||||||
|
}
|
||||||
|
|
||||||
|
for(b in x.inputStream) {
|
||||||
|
System.out?.println(b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,8 +6,8 @@ import junit.framework.TestSuite;
|
|||||||
*/
|
*/
|
||||||
public class TestAll {
|
public class TestAll {
|
||||||
public static TestSuite suite() {
|
public static TestSuite suite() {
|
||||||
TestSuite suite = new TestSuite(CollectionTest.class, IoTest.class, ListTest.class, MapTest.class, SetTest.class);
|
TestSuite suite = new TestSuite(CollectionTest.class, IoTest.class, ListTest.class, MapTest.class, SetTest.class, OldStdlibTest.class);
|
||||||
suite.addTest(testDslExample.namespace.getSuite());
|
suite.addTest(testDslExample.namespace.getSuite());
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user