output: don't postpone failure output

This commit is contained in:
Anna Kozlova
2016-09-13 16:42:49 +03:00
parent 0691899b3a
commit a02afd8c8a
3 changed files with 33 additions and 13 deletions
@@ -532,6 +532,19 @@ public class SMTestProxy extends AbstractTestProxy {
return filterChildren(filter, getChildren());
}
protected void addAfterLastPassed(Printable printable) {
int idx = 0;
synchronized (myNestedPrintables) {
for (Printable proxy : myNestedPrintables) {
if (proxy instanceof SMTestProxy && !((SMTestProxy)proxy).isFinal()) {
break;
}
idx++;
}
}
insert(printable, idx);
}
private static List<? extends SMTestProxy> filterChildren(@Nullable Filter<? super SMTestProxy> filter,
List<? extends SMTestProxy> allChildren) {
if (filter == Filter.NO_FILTER || filter == null) {
@@ -40,6 +40,26 @@ class OutputTest : BaseSMTRunnerTestCase() {
assertEquals("inside test\n", printer.stdOut)
}
fun testBeforeAfterFailedOrder() {
val suite = createTestProxy("parent")
val child = createTestProxy("child", suite)
suite.addStdOutput("before test started\n", ProcessOutputTypes.STDOUT)
child.setStarted()
child.addStdOutput("inside test\n", ProcessOutputTypes.STDOUT)
child.setTestFailed("fail", null, false)
suite.addStdOutput("after test finished\n", ProcessOutputTypes.STDOUT)
val printer = MockPrinter(true)
suite.printOn(printer)
assertEquals("before test started\ninside test\nafter test finished\n", printer.stdOut)
printer.resetIfNecessary()
child.printOn(printer)
assertEquals("inside test\n", printer.stdOut)
}
fun testBeforeAfterOrderWhenFlushed() {
val suite = createTestProxy("parent")
val child = createTestProxy("child", suite)
@@ -149,19 +149,6 @@ public abstract class AbstractTestProxy extends CompositePrintable {
return provider == null ? Collections.<DiffHyperlink>emptyList() : Collections.singletonList(provider);
}
protected void addAfterLastPassed(Printable printable) {
int idx = 0;
synchronized (myNestedPrintables) {
for (Printable proxy : myNestedPrintables) {
if (proxy instanceof AbstractTestProxy && !((AbstractTestProxy)proxy).isPassed()) {
break;
}
idx++;
}
}
insert(printable, idx);
}
@Nullable
public DiffHyperlink getDiffViewerProvider() {
return null;