JS/RTTI: use generation for rtti test

This commit is contained in:
Alexey Tsvetkov
2015-06-10 19:41:35 +03:00
committed by Alexey Andreev
parent 0b9c041d0a
commit c6cf6a0df7
6 changed files with 99 additions and 60 deletions
@@ -1087,6 +1087,10 @@ fun main(args: Array<String>) {
testClass<AbstractReifiedTest>() {
model("reified/cases")
}
testClass(javaClass<AbstractRttiTest>()) {
model("rtti/cases")
}
}
testGroup("js/js.tests/test", "compiler/testData") {
@@ -1,58 +0,0 @@
/*
* Copyright 2010-2015 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.
*/
package org.jetbrains.kotlin.js.test.semantics;
import org.jetbrains.kotlin.js.test.SingleFileTranslationTest;
public class RTTITest extends SingleFileTranslationTest {
public RTTITest() {
super("rtti/");
}
public void testRttiForClass() throws Exception {
checkFooBoxIsOk();
}
public void testRttiForTrait() throws Exception {
checkFooBoxIsOk();
}
public void testRttiForTrait2() throws Exception {
checkFooBoxIsOk();
}
public void testIsSameClass() throws Exception {
fooBoxTest();
}
public void testNotIsOtherClass() throws Exception {
fooBoxTest();
}
public void testCollectionClassesIsCheck() throws Exception {
checkFooBoxIsOk();
}
public void testStdlibEmptyListClass() throws Exception {
checkFooBoxIsOk();
}
public void testIsJsPrimitiveType() throws Exception {
checkFooBoxIsOk();
}
}
@@ -0,0 +1,85 @@
/*
* Copyright 2010-2015 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.
*/
package org.jetbrains.kotlin.js.test.semantics;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.JetTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("js/js.translator/testData/rtti/cases")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class RttiTestGenerated extends AbstractRttiTest {
public void testAllFilesPresentInCases() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/rtti/cases"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("collectionClassesIsCheck.kt")
public void testCollectionClassesIsCheck() throws Exception {
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/rtti/cases/collectionClassesIsCheck.kt");
doTest(fileName);
}
@TestMetadata("isJsPrimitiveType.kt")
public void testIsJsPrimitiveType() throws Exception {
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/rtti/cases/isJsPrimitiveType.kt");
doTest(fileName);
}
@TestMetadata("isSameClass.kt")
public void testIsSameClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/rtti/cases/isSameClass.kt");
doTest(fileName);
}
@TestMetadata("notIsOtherClass.kt")
public void testNotIsOtherClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/rtti/cases/notIsOtherClass.kt");
doTest(fileName);
}
@TestMetadata("rttiForClass.kt")
public void testRttiForClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/rtti/cases/rttiForClass.kt");
doTest(fileName);
}
@TestMetadata("rttiForTrait.kt")
public void testRttiForTrait() throws Exception {
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/rtti/cases/rttiForTrait.kt");
doTest(fileName);
}
@TestMetadata("rttiForTrait2.kt")
public void testRttiForTrait2() throws Exception {
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/rtti/cases/rttiForTrait2.kt");
doTest(fileName);
}
@TestMetadata("stdlibEmptyListClass.kt")
public void testStdlibEmptyListClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/rtti/cases/stdlibEmptyListClass.kt");
doTest(fileName);
}
}
@@ -61,3 +61,5 @@ abstract class AbstractSuperTest : AbstractBlackBoxTest("super/")
abstract class AbstractLocalClassesTest : AbstractBlackBoxTest("localClasses/")
abstract class AbstractNonLocalReturnsTest : KotlinJSMultiFileTest("inline.generated/nonLocalReturns/")
public abstract class AbstractRttiTest : SingleFileTranslationTest("rtti/")
+4 -1
View File
@@ -4,4 +4,7 @@ class A() {
}
fun box() = (A() is A)
fun box(): String {
assertEquals(true, A() is A)
return "OK"
}
+4 -1
View File
@@ -8,4 +8,7 @@ class B() : A() {
}
fun box() = (A() !is B)
fun box(): String {
assertEquals(true, A() !is B)
return "OK"
}