Support JS-targeted diagnostic tests

This commit is contained in:
Andrey Breslav
2014-11-25 18:33:56 +03:00
parent 722624f0a4
commit 2a334fc8f5
7 changed files with 125 additions and 49 deletions
@@ -112,7 +112,7 @@ public class JetTestUtils {
*
* Several files may follow one module
*/
public static final Pattern FILE_OR_MODULE_PATTERN = Pattern.compile("(?://\\s*MODULE:\\s*(\\w+)(\\(\\w+(?:, \\w+)*\\))?\\s*)?" +
public static final Pattern FILE_OR_MODULE_PATTERN = Pattern.compile("(?://\\s*MODULE(?:\\[(\\w+)\\])?:\\s*(\\w+)(\\(\\w+(?:, \\w+)*\\))?\\s*)?" +
"//\\s*FILE:\\s*(.*)$", Pattern.MULTILINE);
public static final Pattern DIRECTIVE_PATTERN = Pattern.compile("^//\\s*!(\\w+)(:\\s*(.*)$)?", Pattern.MULTILINE);
@@ -502,7 +502,7 @@ public class JetTestUtils {
public interface TestFileFactory<M, F> {
F createFile(@Nullable M module, @NotNull String fileName, @NotNull String text, @NotNull Map<String, String> directives);
M createModule(@NotNull String name, @NotNull List<String> dependencies);
M createModule(@NotNull String name, @Nullable String platform, @NotNull List<String> dependencies);
}
public static abstract class TestFileFactoryNoModules<F> implements TestFileFactory<Void, F> {
@@ -520,7 +520,7 @@ public class JetTestUtils {
public abstract F create(@NotNull String fileName, @NotNull String text, @NotNull Map<String, String> directives);
@Override
public Void createModule(@NotNull String name, @NotNull List<String> dependencies) {
public Void createModule(@NotNull String name, @Nullable String platform, @NotNull List<String> dependencies) {
return null;
}
}
@@ -540,13 +540,14 @@ public class JetTestUtils {
M module = null;
// Many files
while (true) {
String moduleName = matcher.group(1);
String moduleDependencies = matcher.group(2);
String platform = matcher.group(1);
String moduleName = matcher.group(2);
String moduleDependencies = matcher.group(3);
if (moduleName != null) {
module = factory.createModule(moduleName, parseDependencies(moduleDependencies));
module = factory.createModule(moduleName, platform, parseDependencies(moduleDependencies));
}
String fileName = matcher.group(3);
String fileName = matcher.group(4);
int start = processedChars;
boolean nextFileExists = matcher.find();