feat(Escaped Identifiers): add ability to use any symbol wrapped in back ticks.

This commit is contained in:
Artem Kobzar
2021-10-29 17:55:59 +00:00
committed by Space
parent ea10b4a781
commit 979e9f94ef
59 changed files with 1260 additions and 159 deletions
@@ -2075,6 +2075,99 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
}
}
@TestMetadata("js/js.translator/testData/box/escapedIdentifiers")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EscapedIdentifiers extends AbstractIrBoxJsES6Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
}
public void testAllFilesPresentInEscapedIdentifiers() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/escapedIdentifiers"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("classLikeMemberClassMangling.kt")
public void testClassLikeMemberClassMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/classLikeMemberClassMangling.kt");
}
@TestMetadata("classLikeMemberFieldMangling.kt")
public void testClassLikeMemberFieldMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/classLikeMemberFieldMangling.kt");
}
@TestMetadata("classLikeMemberFunctionMangling.kt")
public void testClassLikeMemberFunctionMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/classLikeMemberFunctionMangling.kt");
}
@TestMetadata("dynamicEscapedField.kt")
public void testDynamicEscapedField() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/dynamicEscapedField.kt");
}
@TestMetadata("externalEscapedAMDTopLevel.kt")
public void testExternalEscapedAMDTopLevel() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedAMDTopLevel.kt");
}
@TestMetadata("externalEscapedClassFields.kt")
public void testExternalEscapedClassFields() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedClassFields.kt");
}
@TestMetadata("externalEscapedCommonJSTopLevel.kt")
public void testExternalEscapedCommonJSTopLevel() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedCommonJSTopLevel.kt");
}
@TestMetadata("externalEscapedTopLevel.kt")
public void testExternalEscapedTopLevel() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedTopLevel.kt");
}
@TestMetadata("topLevelExportedClass.kt")
public void testTopLevelExportedClass() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedClass.kt");
}
@TestMetadata("topLevelExportedCompanion.kt")
public void testTopLevelExportedCompanion() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedCompanion.kt");
}
@TestMetadata("topLevelExportedFunction.kt")
public void testTopLevelExportedFunction() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedFunction.kt");
}
@TestMetadata("topLevelExportedVariable.kt")
public void testTopLevelExportedVariable() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedVariable.kt");
}
@TestMetadata("topLevelLocalClassMangling.kt")
public void testTopLevelLocalClassMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalClassMangling.kt");
}
@TestMetadata("topLevelLocalCompanionMangling.kt")
public void testTopLevelLocalCompanionMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalCompanionMangling.kt");
}
@TestMetadata("topLevelLocalFunctionMangling.kt")
public void testTopLevelLocalFunctionMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalFunctionMangling.kt");
}
@TestMetadata("topLevelLocalVariableMangling.kt")
public void testTopLevelLocalVariableMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalVariableMangling.kt");
}
}
@TestMetadata("js/js.translator/testData/box/examples")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -84,6 +84,24 @@ public class IrJsTypeScriptExportES6TestGenerated extends AbstractIrJsTypeScript
}
}
@TestMetadata("js/js.translator/testData/typescript-export/escapedDeclarations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EscapedDeclarations extends AbstractIrJsTypeScriptExportES6Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
}
public void testAllFilesPresentInEscapedDeclarations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/escapedDeclarations"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("escapedDeclarations.kt")
public void testEscapedDeclarations() throws Exception {
runTest("js/js.translator/testData/typescript-export/escapedDeclarations/escapedDeclarations.kt");
}
}
@TestMetadata("js/js.translator/testData/typescript-export/inheritance")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -2070,6 +2070,99 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
}
}
@TestMetadata("js/js.translator/testData/box/escapedIdentifiers")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EscapedIdentifiers extends AbstractIrBoxJsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInEscapedIdentifiers() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/escapedIdentifiers"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("classLikeMemberClassMangling.kt")
public void testClassLikeMemberClassMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/classLikeMemberClassMangling.kt");
}
@TestMetadata("classLikeMemberFieldMangling.kt")
public void testClassLikeMemberFieldMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/classLikeMemberFieldMangling.kt");
}
@TestMetadata("classLikeMemberFunctionMangling.kt")
public void testClassLikeMemberFunctionMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/classLikeMemberFunctionMangling.kt");
}
@TestMetadata("dynamicEscapedField.kt")
public void testDynamicEscapedField() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/dynamicEscapedField.kt");
}
@TestMetadata("externalEscapedAMDTopLevel.kt")
public void testExternalEscapedAMDTopLevel() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedAMDTopLevel.kt");
}
@TestMetadata("externalEscapedClassFields.kt")
public void testExternalEscapedClassFields() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedClassFields.kt");
}
@TestMetadata("externalEscapedCommonJSTopLevel.kt")
public void testExternalEscapedCommonJSTopLevel() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedCommonJSTopLevel.kt");
}
@TestMetadata("externalEscapedTopLevel.kt")
public void testExternalEscapedTopLevel() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedTopLevel.kt");
}
@TestMetadata("topLevelExportedClass.kt")
public void testTopLevelExportedClass() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedClass.kt");
}
@TestMetadata("topLevelExportedCompanion.kt")
public void testTopLevelExportedCompanion() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedCompanion.kt");
}
@TestMetadata("topLevelExportedFunction.kt")
public void testTopLevelExportedFunction() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedFunction.kt");
}
@TestMetadata("topLevelExportedVariable.kt")
public void testTopLevelExportedVariable() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedVariable.kt");
}
@TestMetadata("topLevelLocalClassMangling.kt")
public void testTopLevelLocalClassMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalClassMangling.kt");
}
@TestMetadata("topLevelLocalCompanionMangling.kt")
public void testTopLevelLocalCompanionMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalCompanionMangling.kt");
}
@TestMetadata("topLevelLocalFunctionMangling.kt")
public void testTopLevelLocalFunctionMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalFunctionMangling.kt");
}
@TestMetadata("topLevelLocalVariableMangling.kt")
public void testTopLevelLocalVariableMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalVariableMangling.kt");
}
}
@TestMetadata("js/js.translator/testData/box/examples")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -84,6 +84,24 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
}
}
@TestMetadata("js/js.translator/testData/typescript-export/escapedDeclarations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EscapedDeclarations extends AbstractIrJsTypeScriptExportTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInEscapedDeclarations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/escapedDeclarations"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("escapedDeclarations.kt")
public void testEscapedDeclarations() throws Exception {
runTest("js/js.translator/testData/typescript-export/escapedDeclarations/escapedDeclarations.kt");
}
}
@TestMetadata("js/js.translator/testData/typescript-export/inheritance")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -1915,6 +1915,112 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
}
}
@Nested
@TestMetadata("js/js.translator/testData/box/escapedIdentifiers")
@TestDataPath("$PROJECT_ROOT")
public class EscapedIdentifiers {
@Test
public void testAllFilesPresentInEscapedIdentifiers() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/escapedIdentifiers"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("classLikeMemberClassMangling.kt")
public void testClassLikeMemberClassMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/classLikeMemberClassMangling.kt");
}
@Test
@TestMetadata("classLikeMemberFieldMangling.kt")
public void testClassLikeMemberFieldMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/classLikeMemberFieldMangling.kt");
}
@Test
@TestMetadata("classLikeMemberFunctionMangling.kt")
public void testClassLikeMemberFunctionMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/classLikeMemberFunctionMangling.kt");
}
@Test
@TestMetadata("dynamicEscapedField.kt")
public void testDynamicEscapedField() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/dynamicEscapedField.kt");
}
@Test
@TestMetadata("externalEscapedAMDTopLevel.kt")
public void testExternalEscapedAMDTopLevel() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedAMDTopLevel.kt");
}
@Test
@TestMetadata("externalEscapedClassFields.kt")
public void testExternalEscapedClassFields() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedClassFields.kt");
}
@Test
@TestMetadata("externalEscapedCommonJSTopLevel.kt")
public void testExternalEscapedCommonJSTopLevel() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedCommonJSTopLevel.kt");
}
@Test
@TestMetadata("externalEscapedTopLevel.kt")
public void testExternalEscapedTopLevel() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/externalEscapedTopLevel.kt");
}
@Test
@TestMetadata("topLevelExportedClass.kt")
public void testTopLevelExportedClass() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedClass.kt");
}
@Test
@TestMetadata("topLevelExportedCompanion.kt")
public void testTopLevelExportedCompanion() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedCompanion.kt");
}
@Test
@TestMetadata("topLevelExportedFunction.kt")
public void testTopLevelExportedFunction() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedFunction.kt");
}
@Test
@TestMetadata("topLevelExportedVariable.kt")
public void testTopLevelExportedVariable() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelExportedVariable.kt");
}
@Test
@TestMetadata("topLevelLocalClassMangling.kt")
public void testTopLevelLocalClassMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalClassMangling.kt");
}
@Test
@TestMetadata("topLevelLocalCompanionMangling.kt")
public void testTopLevelLocalCompanionMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalCompanionMangling.kt");
}
@Test
@TestMetadata("topLevelLocalFunctionMangling.kt")
public void testTopLevelLocalFunctionMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalFunctionMangling.kt");
}
@Test
@TestMetadata("topLevelLocalVariableMangling.kt")
public void testTopLevelLocalVariableMangling() throws Exception {
runTest("js/js.translator/testData/box/escapedIdentifiers/topLevelLocalVariableMangling.kt");
}
}
@Nested
@TestMetadata("js/js.translator/testData/box/examples")
@TestDataPath("$PROJECT_ROOT")