Remove LANGUAGE_VERSION from compileKotlinAgainstKotlin tests

Support test directives not at the beginning of the test file for
multi-file tests where separate files need separate language features
This commit is contained in:
Alexander Udalov
2018-12-18 16:47:28 +01:00
parent ec2dd58165
commit a0a70dd60d
9 changed files with 9 additions and 59 deletions
@@ -842,16 +842,11 @@ public class KotlinTestUtils {
public static Map<String, String> parseDirectives(String expectedText) {
Map<String, String> directives = new HashMap<>();
Matcher directiveMatcher = DIRECTIVE_PATTERN.matcher(expectedText);
int start = 0;
while (directiveMatcher.find()) {
if (directiveMatcher.start() != start) {
Assert.fail("Directives should only occur at the beginning of a file: " + directiveMatcher.group());
}
String name = directiveMatcher.group(1);
String value = directiveMatcher.group(3);
String oldValue = directives.put(name, value);
Assert.assertNull("Directive overwritten: " + name + " old value: " + oldValue + " new value: " + value, oldValue);
start = directiveMatcher.end() + 1;
}
return directives;
}
@@ -838,16 +838,11 @@ public class KotlinTestUtils {
public static Map<String, String> parseDirectives(String expectedText) {
Map<String, String> directives = new HashMap<>();
Matcher directiveMatcher = DIRECTIVE_PATTERN.matcher(expectedText);
int start = 0;
while (directiveMatcher.find()) {
if (directiveMatcher.start() != start) {
Assert.fail("Directives should only occur at the beginning of a file: " + directiveMatcher.group());
}
String name = directiveMatcher.group(1);
String value = directiveMatcher.group(3);
String oldValue = directives.put(name, value);
Assert.assertNull("Directive overwritten: " + name + " old value: " + oldValue + " new value: " + value, oldValue);
start = directiveMatcher.end() + 1;
}
return directives;
}
@@ -838,16 +838,11 @@ public class KotlinTestUtils {
public static Map<String, String> parseDirectives(String expectedText) {
Map<String, String> directives = new HashMap<>();
Matcher directiveMatcher = DIRECTIVE_PATTERN.matcher(expectedText);
int start = 0;
while (directiveMatcher.find()) {
if (directiveMatcher.start() != start) {
Assert.fail("Directives should only occur at the beginning of a file: " + directiveMatcher.group());
}
String name = directiveMatcher.group(1);
String value = directiveMatcher.group(3);
String oldValue = directives.put(name, value);
Assert.assertNull("Directive overwritten: " + name + " old value: " + oldValue + " new value: " + value, oldValue);
start = directiveMatcher.end() + 1;
}
return directives;
}
@@ -838,16 +838,11 @@ public class KotlinTestUtils {
public static Map<String, String> parseDirectives(String expectedText) {
Map<String, String> directives = new HashMap<>();
Matcher directiveMatcher = DIRECTIVE_PATTERN.matcher(expectedText);
int start = 0;
while (directiveMatcher.find()) {
if (directiveMatcher.start() != start) {
Assert.fail("Directives should only occur at the beginning of a file: " + directiveMatcher.group());
}
String name = directiveMatcher.group(1);
String value = directiveMatcher.group(3);
String oldValue = directives.put(name, value);
Assert.assertNull("Directive overwritten: " + name + " old value: " + oldValue + " new value: " + value, oldValue);
start = directiveMatcher.end() + 1;
}
return directives;
}