Support ignoring by target backend for single generated classes

This commit is contained in:
Zalim Bashorov
2016-11-08 14:28:53 +03:00
parent af4ec9815b
commit 5500f80d0b
@@ -91,6 +91,8 @@ import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.isCompatibleTarget;
public class KotlinTestUtils { public class KotlinTestUtils {
public static String TEST_MODULE_NAME = "test-module"; public static String TEST_MODULE_NAME = "test-module";
@@ -847,7 +849,7 @@ public class KotlinTestUtils {
assertTestClassPresentByMetadata(testCaseClass, file); assertTestClassPresentByMetadata(testCaseClass, file);
} }
} }
else if (filenamePattern.matcher(file.getName()).matches() && InTextDirectivesUtils.isCompatibleTarget(targetBackend, file)) { else if (filenamePattern.matcher(file.getName()).matches() && isCompatibleTarget(targetBackend, file)) {
assertFilePathPresent(file, rootFile, filePaths); assertFilePathPresent(file, rootFile, filePaths);
} }
} }
@@ -857,7 +859,8 @@ public class KotlinTestUtils {
public static void assertAllTestsPresentInSingleGeneratedClass( public static void assertAllTestsPresentInSingleGeneratedClass(
@NotNull Class<?> testCaseClass, @NotNull Class<?> testCaseClass,
@NotNull File testDataDir, @NotNull File testDataDir,
@NotNull final Pattern filenamePattern @NotNull final Pattern filenamePattern,
@NotNull final TargetBackend targetBackend
) { ) {
final File rootFile = new File(getTestsRoot(testCaseClass)); final File rootFile = new File(getTestsRoot(testCaseClass));
@@ -866,7 +869,7 @@ public class KotlinTestUtils {
FileUtil.processFilesRecursively(testDataDir, new Processor<File>() { FileUtil.processFilesRecursively(testDataDir, new Processor<File>() {
@Override @Override
public boolean process(File file) { public boolean process(File file) {
if (file.isFile() && filenamePattern.matcher(file.getName()).matches()) { if (file.isFile() && filenamePattern.matcher(file.getName()).matches() && isCompatibleTarget(targetBackend, file)) {
assertFilePathPresent(file, rootFile, filePaths); assertFilePathPresent(file, rootFile, filePaths);
} }