Test that GenerateJavaToKotlinMethodMap has run correctly
This commit is contained in:
@@ -57,7 +57,14 @@ public class GenerateJavaToKotlinMethodMap {
|
||||
|
||||
public static final String BUILTINS_FQNAME_PREFIX = KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME.asString() + ".";
|
||||
|
||||
public static final File TARGET_FILE =
|
||||
new File("compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/JavaToKotlinMethodMapGenerated.java");
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
GeneratorsFileUtil.writeFileIfContentChanged(TARGET_FILE, generateText().toString());
|
||||
}
|
||||
|
||||
public static CharSequence generateText() throws IOException {
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.add(CLASSPATH_KEY, PathUtil.findRtJar());
|
||||
|
||||
@@ -89,9 +96,7 @@ public class GenerateJavaToKotlinMethodMap {
|
||||
printer.println("map = b.build();");
|
||||
printer.popIndent().println("}");
|
||||
printer.popIndent().println("}");
|
||||
|
||||
File file = new File("compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/JavaToKotlinMethodMapGenerated.java");
|
||||
GeneratorsFileUtil.writeFileIfContentChanged(file, buf.toString());
|
||||
return buf;
|
||||
}
|
||||
|
||||
private static class MyMapBuilder extends JavaToKotlinClassMapBuilder {
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package org.jetbrains.jet.generators.jvm;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class GenerateJavaToKotlinMethodMapTest extends TestCase {
|
||||
public void testGenerateJavaToKotlinMethodMap() throws Exception {
|
||||
String text = StringUtil.convertLineSeparators(GenerateJavaToKotlinMethodMap.generateText().toString());
|
||||
String expected = FileUtil.loadFile(GenerateJavaToKotlinMethodMap.TARGET_FILE, true);
|
||||
Assert.assertEquals("To fix this problem you need to run GenerateJavaToKotlinMethodMap", expected, text);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user