Trying to run stdlib unit tests as part or js.tests: first step

This commit is contained in:
Pavel V. Talanov
2012-07-05 20:15:25 +04:00
parent 5683ee456f
commit ec7b0a1d3a
13 changed files with 391 additions and 57 deletions
@@ -0,0 +1,49 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*Asserter*/
var JsTests = (function() {
var out = null;
function setOut(newOut) {
out = newOut;
}
var Asserter = function(out) {
this.out = out;
this.assertTrue = function (message, actual) {
if (!actual) {
this.out.println(message);
}
};
this.assertEquals = function (message, actual) {
};
};
var test = function(testName, testFun) {
try {
testFun();
}
catch (fail) {
out.println("Test " + testName + " failed");
}
};
return {
test : test,
Asserter : Asserter,
setOut : setOut
}
})();
@@ -0,0 +1,25 @@
package kotlin.test
import kotlin.test.*
import js.*
public var asserter : Asserter = JsTestsAsserter()
native("JsTests.Asserter")
public class JsTestsAsserter(): Asserter {
native
public override fun assertTrue(message: String, actual: Boolean) = noImpl
native
public override fun assertEquals(message: String, expected: Any?, actual: Any?) = noImpl
native
public override fun assertNotNull(message: String, actual: Any?) = noImpl
native
public override fun assertNull(message: String, actual: Any?) = noImpl
native
public override fun fail(message: String) = noImpl
}