data deprecations cleanup: reserved word tests fixed
This commit is contained in:
+10
-3
@@ -158,7 +158,7 @@ fun box(): String {
|
||||
) {
|
||||
case("val", "val $KEYWORD_MARKER", "", testNotRenamedByName)
|
||||
case("var", "var $KEYWORD_MARKER", "", testNotRenamedByName)
|
||||
case("param", "$KEYWORD_MARKER", "",testRenamedByName)
|
||||
case("param", "$KEYWORD_MARKER", "", testRenamedByName, ignore = true)
|
||||
}
|
||||
// -------------------------
|
||||
|
||||
@@ -228,6 +228,7 @@ class Case(
|
||||
val testDeclaration: String,
|
||||
val testDeclarationInit: String,
|
||||
val testBlock: String,
|
||||
val ignore: Boolean,
|
||||
val additionalShouldBeEscaped: Set<String>
|
||||
)
|
||||
|
||||
@@ -240,8 +241,9 @@ class Suite(
|
||||
class CaseBuilder {
|
||||
val cases = arrayListOf<Case>()
|
||||
|
||||
fun case(name: String, testDeclaration: String, testDeclarationInit: String, testBlock: String, additionalShouldBeEscaped: Set<String> = setOf()) {
|
||||
cases.add(Case(name, testDeclaration, testDeclarationInit, testBlock, additionalShouldBeEscaped))
|
||||
fun case(name: String, testDeclaration: String, testDeclarationInit: String, testBlock: String,
|
||||
ignore: Boolean = false, additionalShouldBeEscaped: Set<String> = setOf()) {
|
||||
cases.add(Case(name, testDeclaration, testDeclarationInit, testBlock, ignore, additionalShouldBeEscaped))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,6 +293,11 @@ class TestDataBuilder() {
|
||||
// Uses small portions of keywords instead of ALL_KEYWORDS to avoid a combinatorial explosion
|
||||
// Each portion contains at least one keyword which should be escaped and at least one which should not.
|
||||
for (keyword in nextKeywordPortion()) {
|
||||
|
||||
if (case.ignore) {
|
||||
continue
|
||||
}
|
||||
|
||||
val shouldBeEscaped = keyword in SHOULD_BE_ESCAPED || keyword in case.additionalShouldBeEscaped
|
||||
|
||||
val keywordWithEscapeIfNeed = if (shouldBeEscaped) "`$keyword`" else keyword
|
||||
|
||||
-24
@@ -35,30 +35,6 @@ public class ReservedWordTestGenerated extends AbstractReservedWordTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/reservedWords/cases"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("dataClassParamElse.kt")
|
||||
public void testDataClassParamElse() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/reservedWords/cases/dataClassParamElse.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("dataClassParamFalse.kt")
|
||||
public void testDataClassParamFalse() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/reservedWords/cases/dataClassParamFalse.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("dataClassParamInfinity.kt")
|
||||
public void testDataClassParamInfinity() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/reservedWords/cases/dataClassParamInfinity.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("dataClassParamKotlin.kt")
|
||||
public void testDataClassParamKotlin() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/reservedWords/cases/dataClassParamKotlin.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("dataClassValBreak.kt")
|
||||
public void testDataClassValBreak() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/reservedWords/cases/dataClassValBreak.kt");
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package foo
|
||||
|
||||
// NOTE THIS FILE IS AUTO-GENERATED by the generateTestDataForReservedWords.kt. DO NOT EDIT!
|
||||
|
||||
data class DataClass(`else`: String) {
|
||||
init {
|
||||
testRenamed("else", { `else` })
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
DataClass("123")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package foo
|
||||
|
||||
// NOTE THIS FILE IS AUTO-GENERATED by the generateTestDataForReservedWords.kt. DO NOT EDIT!
|
||||
|
||||
data class DataClass(`false`: String) {
|
||||
init {
|
||||
testRenamed("false", { `false` })
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
DataClass("123")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package foo
|
||||
|
||||
// NOTE THIS FILE IS AUTO-GENERATED by the generateTestDataForReservedWords.kt. DO NOT EDIT!
|
||||
|
||||
data class DataClass(Infinity: String) {
|
||||
init {
|
||||
testRenamed("Infinity", { Infinity })
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
DataClass("123")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package foo
|
||||
|
||||
// NOTE THIS FILE IS AUTO-GENERATED by the generateTestDataForReservedWords.kt. DO NOT EDIT!
|
||||
|
||||
data class DataClass(Kotlin: String) {
|
||||
init {
|
||||
testRenamed("Kotlin", { Kotlin })
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
DataClass("123")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user