added a bunch more JS test cases from standard library test cases

This commit is contained in:
James Strachan
2012-07-03 22:20:00 +01:00
parent 038f0af68f
commit 8f94f5e43f
6 changed files with 23 additions and 7 deletions
+8
View File
@@ -31,6 +31,14 @@ public inline fun arrayList<T>(vararg values: T) : ArrayList<T> {
return list
}
/** Returns a new HashSet with a variable number of initial elements */
public inline fun hashSet<T>(vararg values: T) : HashSet<T> {
val list = HashSet<T>()
for (value in values) {
list.add(value)
}
return list
}
/**
* Returns a new List containing the results of applying the given *transform* function to each [[Map.Entry]] in this [[Map]]
@@ -27,7 +27,11 @@ public class StdLibTestToJSTest extends StdLibTestSupport {
"dom/DomTest.kt",
"js/MapTest.kt",
"js/JsDomTest.kt",
//"iterators/FunctionIteratorTest.kt",
//"iterators/IteratorsTest.kt",
"GetOrElseTest.kt",
"ListTest.kt",
"SetTest.kt",
"StringTest.kt");
}
}
@@ -115,6 +115,8 @@ public abstract class Config {
"/kotlin/JLangIterables.kt",
"/kotlin/JLangIterablesLazy.kt",
"/kotlin/JLangIterablesSpecial.kt",
// TODO "/generated/JUtilIteratorsFromJLangIterables.kt",
// TODO "/generated/JUtilIterablesFromJUtilCollections.kt",
"/kotlin/support/AbstractIterator.kt",
"/kotlin/Standard.kt",
"/kotlin/Strings.kt",
+5 -5
View File
@@ -2,14 +2,14 @@ package test.standard
import kotlin.*
import kotlin.test.*
import junit.framework.TestCase
import org.junit.Test as test
class GetOrElseTest() : TestCase() {
class GetOrElseTest {
val v1: String? = "hello"
val v2: String? = null
var counter = 0
fun testDefaultValue() {
test fun defaultValue() {
assertEquals("hello", v1?: "bar")
expect("hello") {
@@ -17,7 +17,7 @@ class GetOrElseTest() : TestCase() {
}
}
fun testDefaultValueOnNull() {
test fun defaultValueOnNull() {
assertEquals("bar", v2?: "bar")
expect("bar") {
@@ -30,7 +30,7 @@ class GetOrElseTest() : TestCase() {
return "bar"
}
fun testLazyDefaultValue() {
test fun lazyDefaultValue() {
counter = 0
assertEquals("hello", v1?: calculateBar())
@@ -2,7 +2,6 @@ package iterators
import kotlin.*
import kotlin.test.*
import kotlin.util.*
import org.junit.Test
@@ -14,7 +14,10 @@ import java.util.ArrayList
/**
*/
class KDocTest {
Test fun generateKDocForStandardLibrary() {
Test fun dummy() {
}
//Test
fun generateKDocForStandardLibrary() {
var moduleName = "ApiDocsModule.kt"
var dir = "."
if (!File(moduleName).exists()) {