[Test] Add test for KT-66338

This commit is contained in:
Dmitriy Novozhilov
2024-03-12 15:11:04 +02:00
committed by Space Team
parent 55f9f74d5c
commit c818ce9220
3 changed files with 26 additions and 9 deletions
@@ -63,8 +63,7 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.IGNORE_BACKEND_DIRECTIVE_PREFIXES;
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.isIgnoredTarget;
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.*;
public class KotlinTestUtils {
public static String TEST_MODULE_NAME = "test-module";
@@ -83,6 +82,13 @@ public class KotlinTestUtils {
private static final Pattern DIRECTIVE_PATTERN = Pattern.compile("^//\\s*[!]?([A-Z_0-9]+)(:[ \\t]*(.*))?$", Pattern.MULTILINE);
/**
* This directive removes checks if ignored test actually passes or not
* It is very hacky and supposed to be use only in cases when some test passes in one configuration and fails in the other,
* and both those configurations share the same ignore directive
*/
private static final String DONT_CHECK_IGNORED = "DONT_CHECK_IGNORED";
private KotlinTestUtils() {
}
@@ -571,7 +577,9 @@ public class KotlinTestUtils {
return;
}
if (isIgnored) {
boolean dontCheckIgnored = InTextDirectivesUtils.isDirectiveDefined(textWithDirectives(testDataFile), DONT_CHECK_IGNORED);
if (isIgnored && !dontCheckIgnored) {
StringBuilder directivesToRemove = new StringBuilder();
if (AUTOMATICALLY_UNMUTE_PASSED_TESTS) {
for (String ignoreDirective: ignoreDirectives){