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
@@ -1,7 +1,8 @@
// FILE: A.kt
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// TODO: Unmute when automatic conversion experimental <-> release will be implemented
// IGNORE_BACKEND: JS, NATIVE, JVM_IR, JS_IR
import kotlin.coroutines.experimental.*
var callback: (() -> Unit)? = null
@@ -44,7 +45,7 @@ fun builder2(c: suspend String.() -> String): String {
}
// FILE: B.kt
// LANGUAGE_VERSION: 1.3
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
@@ -1,28 +0,0 @@
// FILE: A.kt
// LANGUAGE_VERSION: 1.2
// TODO: Unmute when automatic conversion experimental <-> release will be implemented
// IGNORE_BACKEND: JVM, JS, NATIVE, JVM_IR, JS_IR
val dummy1: suspend () -> String = { "OK" }
val dummy2: suspend String.() -> String = { this + "K" }
val dummy3: suspend String.(String) -> String = { s -> this + s }
// FILE: B.kt
// LANGUAGE_VERSION: 1.3
import kotlin.coroutines.experimental.*
fun box(): String {
// val continuation = object : Continuation<String> {
// override val context = EmptyCoroutineContext
// override fun resume(value: String) {
// }
//
// override fun resumeWithException(exception: Throwable) {
// throw exception
// }
// }
// if (dummy1(continuation) != "OK") return "FAIL 1"
// if ("O".dummy2(continuation) != "OK") return "FAIL 2"
// if ("O".dummy3("K", continuation) != "OK") return "FAIL 3"
return "OK"
}
@@ -1,7 +1,8 @@
// FILE: A.kt
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// TODO: Unmute when automatic conversion experimental <-> release will be implemented
// IGNORE_BACKEND: JS, NATIVE, JVM_IR, JS_IR
import kotlin.coroutines.experimental.*
var callback: (() -> Unit)? = null
@@ -31,7 +32,7 @@ fun (suspend () -> String).builder(): String {
}
// FILE: B.kt
// LANGUAGE_VERSION: 1.3
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
@@ -1,7 +1,8 @@
// FILE: A.kt
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// TODO: Unmute when automatic conversion experimental <-> release will be implemented
// IGNORE_BACKEND: JS, NATIVE, JVM_IR, JS_IR
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
@@ -11,7 +12,7 @@ suspend fun dummy(): String = suspendCoroutine {
}
// FILE: B.kt
// LANGUAGE_VERSION: 1.3
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
@@ -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;
}
@@ -320,11 +320,6 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
runTest("compiler/testData/compileKotlinAgainstKotlin/coroutines/builder.kt");
}
@TestMetadata("lambda.kt")
public void testLambda() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/coroutines/lambda.kt");
}
@TestMetadata("receiver.kt")
public void testReceiver() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/coroutines/receiver.kt");