got more map code compiling to JS and running as unit tests
This commit is contained in:
@@ -30,6 +30,11 @@ public class UnsupportedOperationException(message: String = "") : Exception() {
|
||||
library
|
||||
public class NumberFormatException(message: String = "") : Exception() {}
|
||||
|
||||
library
|
||||
public trait Runnable {
|
||||
open fun run() : Unit;
|
||||
}
|
||||
|
||||
public trait Comparable<T> {
|
||||
fun compareTo(that: T): Int
|
||||
}
|
||||
@@ -39,4 +44,3 @@ public trait Appendable {
|
||||
open fun append(csq: CharSequence?, start: Int, end: Int): Appendable?
|
||||
open fun append(c: Char): Appendable?
|
||||
}
|
||||
|
||||
|
||||
@@ -244,3 +244,8 @@ public class StringBuilder() : Appendable {
|
||||
|
||||
library
|
||||
public class NoSuchElementException() : Exception() {}
|
||||
|
||||
public trait Enumeration<E> {
|
||||
open fun hasMoreElements(): Boolean
|
||||
open fun nextElement(): E?
|
||||
}
|
||||
|
||||
@@ -1,7 +1,26 @@
|
||||
package kotlin
|
||||
|
||||
import java.util.Map as JMap
|
||||
import java.util.Map
|
||||
|
||||
/** Provides [] access to maps */
|
||||
public fun <K, V> JMap<K, V>.set(key : K, value : V): Unit {
|
||||
public fun <K, V> Map<K, V>.set(key : K, value : V): Unit {
|
||||
this.put(key, value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new [[HashMap]] populated with the given tuple values where the first value in each tuple
|
||||
* is the key and the second value is the value
|
||||
*
|
||||
* @includeFunctionBody ../../test/MapTest.kt createUsingTuples
|
||||
*/
|
||||
public inline fun <K,V> hashMap(vararg values: #(K,V)): java.util.HashMap<K,V> {
|
||||
val answer = java.util.HashMap<K,V>()
|
||||
/**
|
||||
TODO replace by this simpler call when we can pass vararg values into other methods
|
||||
answer.putAll(values)
|
||||
*/
|
||||
for (v in values) {
|
||||
answer.put(v._1, v._2)
|
||||
}
|
||||
return answer
|
||||
}
|
||||
@@ -24,8 +24,9 @@ public class StdLibTestToJSTest extends StdLibTestSupport {
|
||||
public void testGenerateTestCase() throws Exception {
|
||||
generateJavaScriptFiles(EcmaVersion.all(),
|
||||
"libraries/stdlib/test",
|
||||
//"dom/DomTest.kt",
|
||||
"js/MapTest.kt",
|
||||
"ListTest.kt",
|
||||
"StringTest.kt",
|
||||
"js/SimpleTest.kt");
|
||||
"StringTest.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ public abstract class Config {
|
||||
@NotNull
|
||||
public static final List<String> LIB_FILE_NAMES_DEPENDENT_ON_STDLIB = Arrays.asList(
|
||||
"/stdlib/jutil.kt",
|
||||
"/stdlib/JUMaps.kt",
|
||||
"/stdlib/test.kt",
|
||||
"/core/stringDefs.kt",
|
||||
"/core/strings.kt"
|
||||
@@ -114,8 +115,9 @@ public abstract class Config {
|
||||
"/kotlin/JLangIterablesLazy.kt",
|
||||
"/kotlin/JLangIterablesSpecial.kt",
|
||||
"/kotlin/support/AbstractIterator.kt",
|
||||
//"/kotlin/Ordering.kt",
|
||||
"/kotlin/Standard.kt",
|
||||
"/kotlin/Strings.kt",
|
||||
"/kotlin/dom/Dom.kt",
|
||||
"/kotlin/test/Test.kt"
|
||||
);
|
||||
|
||||
|
||||
@@ -220,6 +220,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
Kotlin.Runnable = Kotlin.$createClass({
|
||||
run:function () {
|
||||
throw Kotlin.$new(Kotlin.AbstractFunctionInvocationError)();
|
||||
}
|
||||
});
|
||||
|
||||
Kotlin.ArrayIterator = Kotlin.$createClass(Kotlin.Iterator, {
|
||||
initialize: function (array) {
|
||||
this.array = array;
|
||||
|
||||
Reference in New Issue
Block a user