Fixing test data to account for new logging

This commit is contained in:
Andrey Breslav
2012-11-13 15:14:52 +04:00
parent 3a1f3532a0
commit 388cfc5e1a
5 changed files with 25 additions and 3 deletions
@@ -2,8 +2,10 @@ OUT Buildfile: build.xml
OUT
OUT build:
OUT [kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
OUT [kotlinc] LOGGING: Emitting: Hello/namespace.class
OUT [kotlinc] LOGGING: For source: [TestData]/hello.kt
OUT [kotlinc] OUTPUT: Output:
OUT [kotlinc] Hello/namespace.class
OUT [kotlinc] Sources:
OUT [kotlinc] [TestData]/hello.kt
OUT
OUT BUILD SUCCESSFUL
OUT Total time: [time]
@@ -73,5 +73,6 @@ public final class JetCompilerMessagingTest extends IDECompilerMessagingTest {
checker.expect(Message.info().textStartsWith("Using kotlinHome="));
checker.expect(Message.info().textStartsWith("Invoking in-process compiler"));
checker.expect(Message.info().textStartsWith("Kotlin Compiler version"));
checker.expect(Message.stats().text("Configuring the compilation environment"));
}
}
@@ -23,6 +23,7 @@ import org.jetbrains.jet.plugin.compiler.K2JSCompiler;
import org.jetbrains.jet.plugin.project.K2JSModuleComponent;
import static org.jetbrains.jet.plugin.compilerMessages.Message.error;
import static org.jetbrains.jet.plugin.compilerMessages.Message.stats;
import static org.jetbrains.jet.plugin.compilerMessages.Message.warning;
/**
@@ -84,5 +85,6 @@ public final class K2JSCompilerMessagingTest extends IDECompilerMessagingTest {
@Override
protected void checkHeader(@NotNull MessageChecker checker) {
checker.expect(Message.info().textStartsWith("Kotlin Compiler version"));
checker.expect(stats().textMatchesRegexp("Compiling source files: .*/src/test.kt"));
}
}
@@ -42,6 +42,11 @@ public final class Message {
return new Message(CompilerMessageCategory.INFORMATION);
}
@NotNull
public static Message stats() {
return new Message(CompilerMessageCategory.STATISTICS);
}
@NotNull
public CompilerMessageCategory category;
@Nullable
@@ -50,6 +55,8 @@ public final class Message {
public String message = null;
@Nullable
public String textStartsWith = null;
@Nullable
private String textMatchesRegexp = null;
public int column = -1;
public int line = -1;
@@ -80,6 +87,11 @@ public final class Message {
return this;
}
public Message textMatchesRegexp(String regexp) {
this.textMatchesRegexp = regexp;
return this;
}
public void check(@NotNull Message other) {
checkMessages(other);
Assert.assertEquals(other.category, this.category);
@@ -96,6 +108,11 @@ public final class Message {
other.message.startsWith(textStartsWith));
return;
}
if (textMatchesRegexp != null) {
Assert.assertTrue("Message should match regexp:\n" + textMatchesRegexp + "\nBut it is:\n" + other.message,
other.message.matches(textMatchesRegexp));
return;
}
Assert.assertEquals(other.message, this.message);
}
@@ -36,7 +36,7 @@ public final class MessageChecker {
@NotNull
public MessageChecker expect(@NotNull Message message) {
assertTrue("More messages expected:\n" + message.message, iterator.hasNext());
assertTrue("Expected message not present:\n" + message, iterator.hasNext());
message.check(iterator.next());
return this;
}