KT-1051 Java interoperability completion - enum tests and test for auto import directive auto insert

This commit is contained in:
Nikolay Krasko
2012-02-07 14:05:08 +04:00
parent aa9b2db300
commit ddbd86cdf5
11 changed files with 120 additions and 0 deletions
@@ -0,0 +1,7 @@
public class Testing {
public static void test() {
kotlin.enums.KtEnumColor.<caret>
}
}
// EXIST: RED, GREEN, BLUE
@@ -0,0 +1,7 @@
package kotlin.enums
enum class KtEnumColor(val rgb : Int) {
RED : Color(0xFF0000)
GREEN : Color(0x00FF00)
BLUE : Color(0x0000FF)
}
@@ -0,0 +1,7 @@
public class Testing {
public static void test() {
KtEnum<caret>
}
}
// EXIST: KtEnumDirection, KtEnumColor, KtEnumList
@@ -0,0 +1,31 @@
package kotlin.enums
enum class KtEnumDirection {
NORTH
SOUTH
WEST
EAST
}
enum class KtEnumColor(val rgb : Int) {
RED : Color(0xFF0000)
GREEN : Color(0x00FF00)
BLUE : Color(0x0000FF)
}
//enum class KtEnumProtocolState {
// WAITING {
// override fun signal() = TALKING
// }
//
// TALKING {
// override fun signal() = WAITING
// }
//
// abstract fun signal() : ProtocolState
//}
enum class KtEnumList<out T>(val size : Int) {
Nil : List<Nothing>(0)
Cons<T>(h : T, t : List<T>) : List<T>(t.size + 1)
}
@@ -0,0 +1,7 @@
public class Testing {
public static void main(String[] args) {
kotlin.testing.namespace.<caret>
}
}
// EXIST: someFun
@@ -0,0 +1,5 @@
package kotlin.testing
fun someFun() : Int {
return 12
}
@@ -0,0 +1,7 @@
import jettesting.ClassFromJet;
public class Testing {
public static void test() {
ClassFromJet
}
}
@@ -0,0 +1,5 @@
public class Testing {
public static void test() {
ClassFr<caret>
}
}
@@ -0,0 +1,4 @@
package jettesting
class ClassFromJet {
}
@@ -27,6 +27,14 @@ public class JetInJavaCompletionTest extends JetCompletionMultiTestBase {
doFileTest();
}
public void testJetEnums() {
doFileTest();
}
public void testJetEnumFields() {
doFileTest();
}
@Override
protected String getTestDataPath() {
return PluginTestCaseBase.getTestDataPathBase() + "/completion/injava/";
@@ -0,0 +1,32 @@
package org.jetbrains.jet.completion.handlers;
import com.intellij.codeInsight.completion.CompletionTestCase;
import org.jetbrains.jet.plugin.PluginTestCaseBase;
import java.io.File;
/**
* @author Nikolay Krasko
*/
public class JavaCompletionHandlerTest extends CompletionTestCase {
public void testClassAutoImport() {
doTest();
}
public void doTest() {
String fileName = getTestName(false);
try {
configureByFiles(null, fileName + ".java", fileName + ".kt");
complete(2);
checkResultByFile(fileName + ".after.java");
} catch (Exception e) {
throw new AssertionError(e);
}
}
@Override
protected String getTestDataPath() {
return new File(PluginTestCaseBase.getTestDataPathBase(), "/completion/injava/handlers/").getPath() + File.separator;
}
}