Suppress tests marked by TARGET_BACKEND directive when running Android codegen tests

This commit is contained in:
Alexey Andreev
2016-10-18 12:28:56 +03:00
parent c41ec1ddfb
commit 6d230aad35
@@ -243,6 +243,10 @@ public class CodegenTestsOnAndroidGenerator extends KtUsefulTestCase {
else {
String fullFileText = FileUtil.loadFile(file, true);
if (!hasJvmBackendTarget(fullFileText)) {
continue;
}
//TODO: support multifile facades
//TODO: support multifile facades hierarchies
if (hasBoxMethod(fullFileText)) {
@@ -268,6 +272,21 @@ public class CodegenTestsOnAndroidGenerator extends KtUsefulTestCase {
return text.contains("fun box()");
}
private static boolean hasJvmBackendTarget(String text) {
List<String> backends = InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// TARGET_BACKEND: ");
if (backends.isEmpty()) {
return true;
}
for (String backend : backends) {
if (backend.equals("JVM")) {
return true;
}
}
return false;
}
private static void generateTestMethod(Printer p, String testName, String className, String filePath) {
p.println("public void test" + testName + "() throws Exception {");
p.pushIndent();