Better messages for abstract function invocation in kotlin-lib.js.
Cosmetics in StdLibGetOrElseTest.
This commit is contained in:
@@ -23,7 +23,7 @@ import junit.framework.Test;
|
|||||||
*/
|
*/
|
||||||
//NOTE: well, it has tests
|
//NOTE: well, it has tests
|
||||||
@SuppressWarnings("JUnitTestCaseWithNoTests")
|
@SuppressWarnings("JUnitTestCaseWithNoTests")
|
||||||
public class StdLibGetOtElseTest extends JsUnitTestBase {
|
public final class StdLibGetOtElseTest extends JsUnitTestBase {
|
||||||
public static Test suite() throws Exception {
|
public static Test suite() throws Exception {
|
||||||
return createTestSuiteForFile("libraries/stdlib/test/GetOrElseTest.kt");
|
return createTestSuiteForFile("libraries/stdlib/test/GetOrElseTest.kt");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,15 +63,23 @@ var kotlin = {set:function (receiver, key, value) {
|
|||||||
throw Kotlin.$new(Kotlin.Exceptions.NullPointerException)();
|
throw Kotlin.$new(Kotlin.Exceptions.NullPointerException)();
|
||||||
};
|
};
|
||||||
|
|
||||||
function throwAbstractFunctionInvocationError() {
|
function throwAbstractFunctionInvocationError(funName) {
|
||||||
throw new TypeError("Function is abstract");
|
return function() {
|
||||||
|
var message;
|
||||||
|
if (funName !== undefined) {
|
||||||
|
message = "Function " + funName + " is abstract";
|
||||||
|
} else {
|
||||||
|
message = "Function is abstract";
|
||||||
|
}
|
||||||
|
throw new TypeError(message);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Kotlin.Iterator = Kotlin.$createClass({
|
Kotlin.Iterator = Kotlin.$createClass({
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
next: throwAbstractFunctionInvocationError,
|
next: throwAbstractFunctionInvocationError("Iterator#next"),
|
||||||
get_hasNext: throwAbstractFunctionInvocationError
|
get_hasNext: throwAbstractFunctionInvocationError("Iterator#get_hasNext")
|
||||||
});
|
});
|
||||||
|
|
||||||
var ArrayIterator = Kotlin.$createClass(Kotlin.Iterator, {
|
var ArrayIterator = Kotlin.$createClass(Kotlin.Iterator, {
|
||||||
@@ -212,19 +220,19 @@ var kotlin = {set:function (receiver, key, value) {
|
|||||||
Kotlin.Runnable = Kotlin.$createClass({
|
Kotlin.Runnable = Kotlin.$createClass({
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
run: throwAbstractFunctionInvocationError
|
run: throwAbstractFunctionInvocationError("Runnable#run")
|
||||||
});
|
});
|
||||||
|
|
||||||
Kotlin.Comparable = Kotlin.$createClass({
|
Kotlin.Comparable = Kotlin.$createClass({
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
compareTo: throwAbstractFunctionInvocationError
|
compareTo: throwAbstractFunctionInvocationError("Comparable#compareTo")
|
||||||
});
|
});
|
||||||
|
|
||||||
Kotlin.Appendable = Kotlin.$createClass({
|
Kotlin.Appendable = Kotlin.$createClass({
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
append: throwAbstractFunctionInvocationError
|
append: throwAbstractFunctionInvocationError("Appendable#append")
|
||||||
});
|
});
|
||||||
|
|
||||||
Kotlin.parseInt = function (str) {
|
Kotlin.parseInt = function (str) {
|
||||||
@@ -358,7 +366,7 @@ var kotlin = {set:function (receiver, key, value) {
|
|||||||
Kotlin.Comparator = Kotlin.$createClass({
|
Kotlin.Comparator = Kotlin.$createClass({
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
compare: throwAbstractFunctionInvocationError
|
compare: throwAbstractFunctionInvocationError("Comparator#compare")
|
||||||
});
|
});
|
||||||
|
|
||||||
var ComparatorImpl = Kotlin.$createClass(Kotlin.Comparator, {
|
var ComparatorImpl = Kotlin.$createClass(Kotlin.Comparator, {
|
||||||
|
|||||||
Reference in New Issue
Block a user