From 89933439f4d5f5a22e171d789034535e0ae20350 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Thu, 5 Jan 2012 12:15:27 +0000 Subject: [PATCH] added an attempt to use the standard APIs on kotlin.Iterable --- testlib/test/StandardCollectionTest.kt | 20 ++++++++++++++++++++ testlib/test/test/collections/TestAll.java | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 testlib/test/StandardCollectionTest.kt diff --git a/testlib/test/StandardCollectionTest.kt b/testlib/test/StandardCollectionTest.kt new file mode 100644 index 00000000000..42c6a83d01e --- /dev/null +++ b/testlib/test/StandardCollectionTest.kt @@ -0,0 +1,20 @@ +package test.collections + +import std.* +import std.test.* + +class StandardCollectionTest() : TestSupport() { + + fun testAny() { + // TODO is a cast really required? + // doesn't compile without it, see KT-924 + val data: Iterable = std.util.arrayList("foo", "bar") as Iterable + + assert { + data.any{it.startsWith("f")} + } + assertNot { + data.any{it.startsWith("x")} + } + } +} \ No newline at end of file diff --git a/testlib/test/test/collections/TestAll.java b/testlib/test/test/collections/TestAll.java index 6003899551e..7e2c67bbe7b 100644 --- a/testlib/test/test/collections/TestAll.java +++ b/testlib/test/test/collections/TestAll.java @@ -6,7 +6,7 @@ import junit.framework.TestSuite; */ public class TestAll { public static TestSuite suite() { - TestSuite suite = new TestSuite(CollectionTest.class, IoTest.class, ListTest.class, MapTest.class, SetTest.class, OldStdlibTest.class); + TestSuite suite = new TestSuite(StandardCollectionTest.class, CollectionTest.class, IoTest.class, ListTest.class, MapTest.class, SetTest.class, OldStdlibTest.class); suite.addTest(testDslExample.namespace.getSuite()); return suite; }