JS frontend: allow to omit body for native functions and initializer for native properties. Additionally suppress UNUSED_PARAM for new nativeX annotations too.

This commit is contained in:
Zalim Bashorov
2014-12-26 19:10:12 +03:00
parent 41dff74037
commit 9869ae10e5
25 changed files with 616 additions and 43 deletions
@@ -228,7 +228,7 @@ public class JetDiagnosticsTestWithJsStdLibGenerated extends AbstractJetDiagnost
@TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native")
@TestDataPath("$PROJECT_ROOT")
@InnerTestClasses({Native.NativeGetter.class, Native.NativeInvoke.class, Native.NativeSetter.class})
@InnerTestClasses({Native.NativeGetter.class, Native.NativeInvoke.class, Native.NativeSetter.class, Native.OptionlBody.class, Native.UnusedParam.class})
@RunWith(JUnit3RunnerWithInners.class)
public static class Native extends AbstractJetDiagnosticsTestWithJsStdLib {
public void testAllFilesPresentInNative() throws Exception {
@@ -441,5 +441,71 @@ public class JetDiagnosticsTestWithJsStdLibGenerated extends AbstractJetDiagnost
doTest(fileName);
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/optionlBody")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class OptionlBody extends AbstractJetDiagnosticsTestWithJsStdLib {
public void testAllFilesPresentInOptionlBody() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib/native/optionlBody"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("native.kt")
public void testNative() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/optionlBody/native.kt");
doTest(fileName);
}
@TestMetadata("nativeGetter.kt")
public void testNativeGetter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/optionlBody/nativeGetter.kt");
doTest(fileName);
}
@TestMetadata("nativeInvoke.kt")
public void testNativeInvoke() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/optionlBody/nativeInvoke.kt");
doTest(fileName);
}
@TestMetadata("nativeSetter.kt")
public void testNativeSetter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/optionlBody/nativeSetter.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/unusedParam")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class UnusedParam extends AbstractJetDiagnosticsTestWithJsStdLib {
public void testAllFilesPresentInUnusedParam() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib/native/unusedParam"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("native.kt")
public void testNative() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/unusedParam/native.kt");
doTest(fileName);
}
@TestMetadata("nativeGetter.kt")
public void testNativeGetter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/unusedParam/nativeGetter.kt");
doTest(fileName);
}
@TestMetadata("nativeInvoke.kt")
public void testNativeInvoke() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/unusedParam/nativeInvoke.kt");
doTest(fileName);
}
@TestMetadata("nativeSetter.kt")
public void testNativeSetter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/unusedParam/nativeSetter.kt");
doTest(fileName);
}
}
}
}
@@ -192,12 +192,6 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
doJsTest(fileName);
}
@TestMetadata("nativeDeclarations.args")
public void testNativeDeclarations() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/nativeDeclarations.args");
doJsTest(fileName);
}
@TestMetadata("notValidLibraryDir.args")
public void testNotValidLibraryDir() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/notValidLibraryDir.args");
@@ -56,13 +56,6 @@ public class K2JsCliTest extends CliBaseTest {
executeCompilerCompareOutputJS();
}
@Test
public void nativeDeclarations() throws Exception {
executeCompilerCompareOutputJS();
Assert.assertTrue(new File(tmpdir.getTmpDir(), "out.js").isFile());
}
@Test
public void withLib() throws Exception {
executeCompilerCompareOutputJS();