Add ability to ignore test for backend w/o checks
It used for the tests from this commit becouse they was failing during setup.
This commit is contained in:
@@ -233,10 +233,18 @@ public final class InTextDirectivesUtils {
|
|||||||
return backends.isEmpty() || backends.contains(targetBackend.name());
|
return backends.isEmpty() || backends.contains(targetBackend.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isIgnoredTarget(TargetBackend targetBackend, File file) {
|
private static boolean isIgnoredTargetByPrefix(TargetBackend targetBackend, File file, String prefix) {
|
||||||
if (targetBackend == TargetBackend.ANY) return false;
|
if (targetBackend == TargetBackend.ANY) return false;
|
||||||
|
|
||||||
List<String> ignoredBackends = findLinesWithPrefixesRemoved(textWithDirectives(file), "// IGNORE_BACKEND: ");
|
List<String> ignoredBackends = findLinesWithPrefixesRemoved(textWithDirectives(file), prefix);
|
||||||
return ignoredBackends.contains(targetBackend.name());
|
return ignoredBackends.contains(targetBackend.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isIgnoredTarget(TargetBackend targetBackend, File file) {
|
||||||
|
return isIgnoredTargetByPrefix(targetBackend, file, "// IGNORE_BACKEND: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isIgnoredTargetWithoutCheck(TargetBackend targetBackend, File file) {
|
||||||
|
return isIgnoredTargetByPrefix(targetBackend, file, "// IGNORE_BACKEND_WITHOUT_CHECK: ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -30,6 +30,7 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.isIgnoredTarget;
|
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.isIgnoredTarget;
|
||||||
|
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.isIgnoredTargetWithoutCheck;
|
||||||
|
|
||||||
public class SimpleTestMethodModel implements TestMethodModel {
|
public class SimpleTestMethodModel implements TestMethodModel {
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ public class SimpleTestMethodModel implements TestMethodModel {
|
|||||||
String relativePath = FileUtil.getRelativePath(rootDir, file.getParentFile());
|
String relativePath = FileUtil.getRelativePath(rootDir, file.getParentFile());
|
||||||
unescapedName = relativePath + "-" + StringUtil.capitalize(extractedName);
|
unescapedName = relativePath + "-" + StringUtil.capitalize(extractedName);
|
||||||
}
|
}
|
||||||
return "test" + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName));
|
return (isIgnoredTargetWithoutCheck(targetBackend, file) ? "ignore" : "test") + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -1,2 +1,2 @@
|
|||||||
// See KT-13691
|
// TODO: See KT-13618
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND_WITHOUT_CHECK: JS
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// TODO Remove this restriction when secondary constructors will be supported in js backend.
|
// TODO Remove this restriction when secondary constructors will be supported in js backend.
|
||||||
// See KT-7798 JS: add support for secondary constructors
|
// See KT-7798 JS: add support for secondary constructors
|
||||||
// https://youtrack.jetbrains.com/issue/KT-7798
|
// https://youtrack.jetbrains.com/issue/KT-7798
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND_WITHOUT_CHECK: JS
|
||||||
|
|||||||
+12
-22
@@ -32,6 +32,18 @@ import java.util.regex.Pattern;
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public class CommonDecompiledTextFromJsMetadataTestGenerated extends AbstractCommonDecompiledTextFromJsMetadataTest {
|
public class CommonDecompiledTextFromJsMetadataTestGenerated extends AbstractCommonDecompiledTextFromJsMetadataTest {
|
||||||
|
@TestMetadata("LocalClassAsTypeWithArgument")
|
||||||
|
public void ignoreLocalClassAsTypeWithArgument() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/LocalClassAsTypeWithArgument/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("SecondaryConstructors")
|
||||||
|
public void ignoreSecondaryConstructors() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/SecondaryConstructors/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInDecompiledText() throws Exception {
|
public void testAllFilesPresentInDecompiledText() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/decompiler/decompiledText"), Pattern.compile("^([^\\.]+)$"), TargetBackend.JS, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/decompiler/decompiledText"), Pattern.compile("^([^\\.]+)$"), TargetBackend.JS, true);
|
||||||
}
|
}
|
||||||
@@ -108,17 +120,6 @@ public class CommonDecompiledTextFromJsMetadataTestGenerated extends AbstractCom
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("LocalClassAsTypeWithArgument")
|
|
||||||
public void testLocalClassAsTypeWithArgument() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/LocalClassAsTypeWithArgument/");
|
|
||||||
try {
|
|
||||||
doTest(fileName);
|
|
||||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
|
||||||
}
|
|
||||||
catch (Throwable ignore) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("Modifiers")
|
@TestMetadata("Modifiers")
|
||||||
public void testModifiers() throws Exception {
|
public void testModifiers() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/Modifiers/");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/Modifiers/");
|
||||||
@@ -137,17 +138,6 @@ public class CommonDecompiledTextFromJsMetadataTestGenerated extends AbstractCom
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("SecondaryConstructors")
|
|
||||||
public void testSecondaryConstructors() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/SecondaryConstructors/");
|
|
||||||
try {
|
|
||||||
doTest(fileName);
|
|
||||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
|
||||||
}
|
|
||||||
catch (Throwable ignore) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("SimpleClass")
|
@TestMetadata("SimpleClass")
|
||||||
public void testSimpleClass() throws Exception {
|
public void testSimpleClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/SimpleClass/");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/SimpleClass/");
|
||||||
|
|||||||
Reference in New Issue
Block a user