Refactored tests for keywords insertion to be all generated
This commit is contained in:
@@ -139,6 +139,7 @@ import org.jetbrains.k2js.test.semantics.AbstractMultiModuleTest
|
||||
import org.jetbrains.jet.completion.handlers.AbstractBasicCompletionHandlerTest
|
||||
import org.jetbrains.jet.plugin.decompiler.stubBuilder.AbstractClsStubBuilderTest
|
||||
import org.jetbrains.jet.codegen.AbstractLineNumberTest
|
||||
import org.jetbrains.jet.completion.handlers.AbstractKeywordCompletionHandlerTest
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
@@ -378,6 +379,10 @@ fun main(args: Array<String>) {
|
||||
model("completion/handlers/smart")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractKeywordCompletionHandlerTest>()) {
|
||||
model("completion/handlers/keywords")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractCompletionCharFilterTest>()) {
|
||||
model("completion/handlers/charFilter")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
fun test() {
|
||||
nul<caret>
|
||||
}
|
||||
|
||||
// ELEMENT: null
|
||||
@@ -0,0 +1,5 @@
|
||||
fun test() {
|
||||
null<caret>
|
||||
}
|
||||
|
||||
// ELEMENT: null
|
||||
@@ -0,0 +1 @@
|
||||
impor<caret>
|
||||
@@ -0,0 +1 @@
|
||||
import <caret>
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.jet.completion;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.jet.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
|
||||
@@ -77,3 +77,8 @@ public abstract class AbstractCompletionCharFilterTest() : AbstractCompletionHan
|
||||
override val defaultCompletionType: CompletionType = CompletionType.BASIC
|
||||
override val testDataRelativePath: String = "/completion/handlers/charFilter"
|
||||
}
|
||||
|
||||
public abstract class AbstractKeywordCompletionHandlerTest() : AbstractCompletionHandlerTest() {
|
||||
override val defaultCompletionType: CompletionType = CompletionType.BASIC
|
||||
override val testDataRelativePath: String = "/completion/handlers/keywords"
|
||||
}
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.completion.handlers;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.jet.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/testData/completion/handlers/keywords")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class KeywordCompletionHandlerTestGenerated extends AbstractKeywordCompletionHandlerTest {
|
||||
public void testAllFilesPresentInKeywords() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/completion/handlers/keywords"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("Break.kt")
|
||||
public void testBreak() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/keywords/Break.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NoSpaceAfterNull.kt")
|
||||
public void testNoSpaceAfterNull() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/keywords/NoSpaceAfterNull.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ReturnInEmptyType.kt")
|
||||
public void testReturnInEmptyType() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/keywords/ReturnInEmptyType.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ReturnInProperty.kt")
|
||||
public void testReturnInProperty() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/keywords/ReturnInProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ReturnInTypeFunction.kt")
|
||||
public void testReturnInTypeFunction() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/keywords/ReturnInTypeFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ReturnInUnit.kt")
|
||||
public void testReturnInUnit() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/keywords/ReturnInUnit.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("SpaceAfterImport.kt")
|
||||
public void testSpaceAfterImport() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/keywords/SpaceAfterImport.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* 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.completion.handlers;
|
||||
|
||||
import com.intellij.codeInsight.completion.LightCompletionTestCase;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class KeywordsHandlerTest extends LightCompletionTestCase {
|
||||
|
||||
public void testSpaceAfter() throws IOException {
|
||||
configureFromFileText("Test.kt", "impor<caret>");
|
||||
complete();
|
||||
checkResultByText("import <caret>");
|
||||
}
|
||||
|
||||
public void testNoSpaceAfter() throws IOException {
|
||||
configureFromFileText("Test.kt", "fun test() { nul<caret> }");
|
||||
forceCompleteFirst();
|
||||
checkResultByText("fun test() { null<caret> }");
|
||||
}
|
||||
|
||||
public void testBreak() {
|
||||
doFileTest();
|
||||
}
|
||||
|
||||
public void testReturnInEmptyType() {
|
||||
doFileTest();
|
||||
}
|
||||
|
||||
public void testReturnInProperty() {
|
||||
doFileTest();
|
||||
}
|
||||
|
||||
public void testReturnInTypeFunction() {
|
||||
doFileTest();
|
||||
}
|
||||
|
||||
public void testReturnInUnit() {
|
||||
doFileTest();
|
||||
}
|
||||
|
||||
protected void doFileTest() {
|
||||
configureByFile(getTestName(false) + ".kt");
|
||||
complete();
|
||||
checkResultByFile(getTestName(false) + "_after.kt");
|
||||
}
|
||||
|
||||
protected void forceCompleteFirst() {
|
||||
complete();
|
||||
if (myItems != null && myItems.length > 1) {
|
||||
selectItem(myItems[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return new File(PluginTestCaseBase.getTestDataPathBase(), "/completion/handlers/keywords").getPath() +
|
||||
File.separator;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user