Test data generated from both files separated in 717f03f474

This commit is contained in:
Andrey Breslav
2014-04-24 16:21:06 +04:00
parent 1efdd33dbd
commit 5536f4da07
2 changed files with 33 additions and 27 deletions
@@ -35,7 +35,10 @@ public class GenerateRangesCodegenTestData {
private static final File TEST_DATA_DIR = new File("compiler/testData/codegen/boxWithStdlib/ranges"); private static final File TEST_DATA_DIR = new File("compiler/testData/codegen/boxWithStdlib/ranges");
private static final File AS_LITERAL_DIR = new File(TEST_DATA_DIR, "literal"); private static final File AS_LITERAL_DIR = new File(TEST_DATA_DIR, "literal");
private static final File AS_EXPRESSION_DIR = new File(TEST_DATA_DIR, "expression"); private static final File AS_EXPRESSION_DIR = new File(TEST_DATA_DIR, "expression");
private static final File SOURCE_TEST_FILE = new File("libraries/stdlib/test/language/RangeIterationTest.kt"); private static final File[] SOURCE_TEST_FILES = {
new File("libraries/stdlib/test/language/RangeIterationTest.kt"),
new File("libraries/stdlib/test/language/RangeIterationTestJVM.kt")
};
private static final Pattern TEST_FUN_PATTERN = Pattern.compile("test fun (\\w+)\\(\\) \\{.+?}", Pattern.DOTALL); private static final Pattern TEST_FUN_PATTERN = Pattern.compile("test fun (\\w+)\\(\\) \\{.+?}", Pattern.DOTALL);
private static final Pattern SUBTEST_INVOCATION_PATTERN = Pattern.compile("doTest\\(([^,]+), [^,]+, [^,]+, [^,]+,\\s+listOf[\\w<>]*\\(([^\\n]*)\\)\\)", Pattern.DOTALL); private static final Pattern SUBTEST_INVOCATION_PATTERN = Pattern.compile("doTest\\(([^,]+), [^,]+, [^,]+, [^,]+,\\s+listOf[\\w<>]*\\(([^\\n]*)\\)\\)", Pattern.DOTALL);
@@ -144,7 +147,8 @@ public class GenerateRangesCodegenTestData {
//noinspection ResultOfMethodCallIgnored //noinspection ResultOfMethodCallIgnored
AS_EXPRESSION_DIR.mkdirs(); AS_EXPRESSION_DIR.mkdirs();
String sourceContent = FileUtil.loadFile(SOURCE_TEST_FILE); for (File file : SOURCE_TEST_FILES) {
String sourceContent = FileUtil.loadFile(file);
Matcher testFunMatcher = TEST_FUN_PATTERN.matcher(sourceContent); Matcher testFunMatcher = TEST_FUN_PATTERN.matcher(sourceContent);
while (testFunMatcher.find()) { while (testFunMatcher.find()) {
String testFunName = testFunMatcher.group(1); String testFunName = testFunMatcher.group(1);
@@ -172,6 +176,7 @@ public class GenerateRangesCodegenTestData {
writeToFile(new File(AS_LITERAL_DIR, fileName), asLiteralBody.toString()); writeToFile(new File(AS_LITERAL_DIR, fileName), asLiteralBody.toString());
writeToFile(new File(AS_EXPRESSION_DIR, fileName), asExpressionBody.toString()); writeToFile(new File(AS_EXPRESSION_DIR, fileName), asExpressionBody.toString());
} }
}
} }
catch (IOException e) { catch (IOException e) {
@@ -15,6 +15,7 @@ import java.lang.Character.MIN_VALUE as MinC
import kotlin.test.assertEquals import kotlin.test.assertEquals
import org.junit.Test as test import org.junit.Test as test
// Test data for codegen is generated from this class. If you change it, rerun GenerateTests
public class RangeIterationTestJVM { public class RangeIterationTestJVM {
private fun <N> doTest( private fun <N> doTest(
sequence: Progression<N>, sequence: Progression<N>,