Skip to content

Commit

Permalink
CommandLineRunnerTest: If the exit code is nonzero, print the content…
Browse files Browse the repository at this point in the history
…s of the "err" printstream, that is, the text that would have gone to stderr in a real compilation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156796045
  • Loading branch information
tbreisacher authored and blickly committed May 22, 2017
1 parent 549eff8 commit cc08013
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/com/google/javascript/jscomp/CommandLineRunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,12 @@ private void test(String[] original, String[] compiled, DiagnosticType warning)
exitCodes.clear();
Compiler compiler = compile(original);

assertThat(exitCodes).hasSize(1);
if (exitCodes.get(0) != 0) {
throw new AssertionError("Got nonzero exit code " + exitCodes.get(0)
+ "\nContents of err printstream:\n" + errReader);
}

if (warning == null) {
assertEquals("Expected no warnings or errors"
+ "\nErrors: \n" + Joiner.on("\n").join(compiler.getErrors())
Expand All @@ -2080,8 +2086,6 @@ private void test(String[] original, String[] compiled, DiagnosticType warning)
"\nResult: " + compiler.toSource(root) +
"\n" + explanation, explanation);
}

assertThat(exitCodes).containsExactly(0);
}

/**
Expand Down

0 comments on commit cc08013

Please sign in to comment.