Udate test framework for confidence tests. Move type directive to test files
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
12.in<caret>
|
12.in<caret>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "."
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
12.inc(). <caret>
|
12.inc().<caret>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "."
|
||||||
@@ -1 +1,3 @@
|
|||||||
import kotlin.util <caret>// Comment to prevent for removing trailing spaces
|
import kotlin.util <caret>// Comment to prevent for removing trailing spaces
|
||||||
|
|
||||||
|
// TYPE: "as"
|
||||||
@@ -1 +1,3 @@
|
|||||||
import kotlin.util as // Comment to prevent for removing trailing spaces
|
import kotlin.util as// Comment to prevent for removing trailing spaces
|
||||||
|
|
||||||
|
// TYPE: "as"
|
||||||
@@ -2,3 +2,5 @@ fun main(args : Array<String>) {
|
|||||||
val mmm = 12
|
val mmm = 12
|
||||||
val t = { <caret>}
|
val t = { <caret>}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "mm "
|
||||||
@@ -2,3 +2,5 @@ fun main(args : Array<String>) {
|
|||||||
val mmm = 12
|
val mmm = 12
|
||||||
val t = { mm }
|
val t = { mm }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "mm "
|
||||||
@@ -2,3 +2,5 @@ fun main(args : Array<String>) {
|
|||||||
val mmm = 12
|
val mmm = 12
|
||||||
val t = { (<caret>) }
|
val t = { (<caret>) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "mm "
|
||||||
@@ -2,3 +2,5 @@ fun main(args : Array<String>) {
|
|||||||
val mmm = 12
|
val mmm = 12
|
||||||
val t = { (mm ) }
|
val t = { (mm ) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "mm "
|
||||||
@@ -2,3 +2,5 @@ fun main(args : Array<String>) {
|
|||||||
val mmm = 12
|
val mmm = 12
|
||||||
val t = { i -> <caret>}
|
val t = { i -> <caret>}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "mm "
|
||||||
@@ -2,3 +2,5 @@ fun main(args : Array<String>) {
|
|||||||
val mmm = 12
|
val mmm = 12
|
||||||
val t = { i -> mmm }
|
val t = { i -> mmm }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "mm "
|
||||||
@@ -3,3 +3,5 @@ package test
|
|||||||
import java.util.AbstractSet as Hello
|
import java.util.AbstractSet as Hello
|
||||||
|
|
||||||
<caret>// Comment to prevent for removing trailing spaces
|
<caret>// Comment to prevent for removing trailing spaces
|
||||||
|
|
||||||
|
// TYPE: "pub "
|
||||||
@@ -3,3 +3,5 @@ package test
|
|||||||
import java.util.AbstractSet as Hello
|
import java.util.AbstractSet as Hello
|
||||||
|
|
||||||
public // Comment to prevent for removing trailing spaces
|
public // Comment to prevent for removing trailing spaces
|
||||||
|
|
||||||
|
// TYPE: "pub "
|
||||||
@@ -2,3 +2,5 @@ fun test() {
|
|||||||
for (i in 12.<caret>) {
|
for (i in 12.<caret>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "."
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
for (i in 12.. ) {
|
for (i in 12..) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TYPE: "."
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ import com.intellij.codeInsight.completion.CompletionType;
|
|||||||
import com.intellij.codeInsight.completion.LightCompletionTestCase;
|
import com.intellij.codeInsight.completion.LightCompletionTestCase;
|
||||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||||
import com.intellij.openapi.projectRoots.Sdk;
|
import com.intellij.openapi.projectRoots.Sdk;
|
||||||
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
import org.apache.commons.lang.SystemUtils;
|
import org.apache.commons.lang.SystemUtils;
|
||||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||||
|
import org.jetbrains.jet.testing.InTextDirectivesUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -30,40 +32,51 @@ import java.io.File;
|
|||||||
* @author Nikolay Krasko
|
* @author Nikolay Krasko
|
||||||
*/
|
*/
|
||||||
public class JetConfidenceTest extends LightCompletionTestCase {
|
public class JetConfidenceTest extends LightCompletionTestCase {
|
||||||
|
private static final String TYPE_DIRECTIVE_PREFIX = "// TYPE:";
|
||||||
|
|
||||||
public void testCompleteOnDotOutOfRanges() {
|
public void testCompleteOnDotOutOfRanges() {
|
||||||
doTest(".");
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testImportAsConfidence() {
|
public void testImportAsConfidence() {
|
||||||
doTest("as");
|
doTest();
|
||||||
}
|
|
||||||
|
|
||||||
public void testInModifierList() {
|
|
||||||
doTest("pub");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInBeginningOfFunctionLiteral() {
|
public void testInBeginningOfFunctionLiteral() {
|
||||||
doTest("mm");
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInBeginningOfFunctionLiteralInBrackets() {
|
public void testInBeginningOfFunctionLiteralInBrackets() {
|
||||||
doTest("mm");
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInBlockOfFunctionLiteral() {
|
public void testInBlockOfFunctionLiteral() {
|
||||||
doTest("mm");
|
doTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testInModifierList() {
|
||||||
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoAutoCompletionForRangeOperator() {
|
public void testNoAutoCompletionForRangeOperator() {
|
||||||
doTest(".");
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doTest(String completionActivateType) {
|
protected void doTest() {
|
||||||
configureByFile(getBeforeFileName());
|
configureByFile(getBeforeFileName());
|
||||||
type(completionActivateType + " ");
|
type(getTypeTextFromFile());
|
||||||
checkResultByFile(getAfterFileName());
|
checkResultByFile(getAfterFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static String getTypeTextFromFile() {
|
||||||
|
String text = getEditor().getDocument().getText();
|
||||||
|
|
||||||
|
String[] directives = InTextDirectivesUtils.findListWithPrefix(TYPE_DIRECTIVE_PREFIX, text);
|
||||||
|
assertEquals("One directive with \"" + TYPE_DIRECTIVE_PREFIX +"\" expected", 1, directives.length);
|
||||||
|
|
||||||
|
return StringUtil.unquoteString(directives[0]);
|
||||||
|
}
|
||||||
|
|
||||||
protected String getBeforeFileName() {
|
protected String getBeforeFileName() {
|
||||||
return getTestName(false) + ".kt";
|
return getTestName(false) + ".kt";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user