Skip to content

Commit

Permalink
JS checker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
goodwinnk committed Apr 3, 2013
1 parent 6e43b78 commit e94843b
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import junit.framework.TestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve;
import org.jetbrains.jet.checkers.AbstractJetJsCheckerTest;
import org.jetbrains.jet.checkers.AbstractJetPsiCheckerTest;
import org.jetbrains.jet.codegen.AbstractBytecodeTextTest;
import org.jetbrains.jet.codegen.AbstractCheckLocalVariablesTableTest;
Expand Down Expand Up @@ -207,6 +208,13 @@ public static void main(String[] args) throws IOException {
testModel("idea/testData/checker/infos", false, "kt", "doTestWithInfos")
);

generateTest(
"idea/tests/",
"JetJsCheckerTestGenerated",
AbstractJetJsCheckerTest.class,
testModel("idea/testData/checker/js", false, "kt", "doTest")
);

generateTest(
"idea/tests/",
"QuickFixTestGenerated",
Expand Down
2 changes: 2 additions & 0 deletions idea/testData/checker/js/basic.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fun test() {
}
3 changes: 3 additions & 0 deletions idea/testData/checker/js/helloWorld.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fun main(args: Array<String>) {
println("Hello World")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2010-2013 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.jet.checkers;

import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.plugin.JetStdJSProjectDescriptor;

public abstract class AbstractJetJsCheckerTest extends LightCodeInsightFixtureTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JetStdJSProjectDescriptor.INSTANCE;
}

public void doTest(String filePath) {
myFixture.configureByFile(filePath);
myFixture.checkHighlighting();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2010-2013 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.jet.checkers;

import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;

import java.io.File;
import java.util.regex.Pattern;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.test.InnerTestClasses;
import org.jetbrains.jet.test.TestMetadata;

import org.jetbrains.jet.checkers.AbstractJetJsCheckerTest;

/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/checker/js")
public class JetJsCheckerTestGenerated extends AbstractJetJsCheckerTest {
public void testAllFilesPresentInJs() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/checker/js"), Pattern.compile("^(.+)\\.kt$"), false);
}

@TestMetadata("basic.kt")
public void testBasic() throws Exception {
doTest("idea/testData/checker/js/basic.kt");
}

@TestMetadata("helloWorld.kt")
public void testHelloWorld() throws Exception {
doTest("idea/testData/checker/js/helloWorld.kt");
}

}

0 comments on commit e94843b

Please sign in to comment.