mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
comparison failure: don't pass expected/actual if files are available - less memory usage
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -87,17 +87,20 @@ public class ComparisonFailureData {
|
||||
attrs.put("details", failureIdx > -1 ? trace.substring(failureIdx + failureMessageLength) : trace);
|
||||
|
||||
if (notification != null) {
|
||||
attrs.put("expected", notification.getExpected());
|
||||
attrs.put("actual", notification.getActual());
|
||||
|
||||
final String filePath = notification.getFilePath();
|
||||
if (filePath != null) {
|
||||
attrs.put("expectedFile", filePath);
|
||||
}
|
||||
else {
|
||||
attrs.put("expected", notification.getExpected());
|
||||
}
|
||||
final String actualFilePath = notification.getActualFilePath();
|
||||
if (actualFilePath != null) {
|
||||
attrs.put("actualFile", actualFilePath);
|
||||
}
|
||||
else {
|
||||
attrs.put("actual", notification.getActual());
|
||||
}
|
||||
final int expectedIdx = trace.indexOf("expected:<");
|
||||
final String comparisonFailureMessage;
|
||||
if (expectedIdx > 0) {
|
||||
|
||||
+33
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,11 +15,15 @@
|
||||
*/
|
||||
package com.intellij.execution.testframework.sm.runner.events;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import jetbrains.buildServer.messages.serviceMessages.TestFailed;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestFailedEvent extends TreeNodeEvent {
|
||||
|
||||
private final String myLocalizedFailureMessage;
|
||||
@@ -46,10 +50,27 @@ public class TestFailedEvent extends TreeNodeEvent {
|
||||
myLocalizedFailureMessage = testFailed.getFailureMessage();
|
||||
myStacktrace = testFailed.getStacktrace();
|
||||
myTestError = testError;
|
||||
myComparisonFailureActualText = testFailed.getActual();
|
||||
myComparisonFailureExpectedText = testFailed.getExpected();
|
||||
|
||||
myExpectedFilePath = expectedFilePath;
|
||||
String expected = testFailed.getExpected();
|
||||
if (expected == null && expectedFilePath != null) {
|
||||
try {
|
||||
expected = FileUtil.loadFile(new File(expectedFilePath));
|
||||
}
|
||||
catch (IOException ignore) {}
|
||||
}
|
||||
myComparisonFailureExpectedText = expected;
|
||||
|
||||
myActualFilePath = actualFilePath;
|
||||
String actual = testFailed.getActual();
|
||||
if (actual == null && actualFilePath != null) {
|
||||
try {
|
||||
actual = FileUtil.loadFile(new File(actualFilePath));
|
||||
}
|
||||
catch (IOException ignore) {}
|
||||
}
|
||||
myComparisonFailureActualText = actual;
|
||||
|
||||
myDurationMillis = parseDuration(testFailed.getAttributes().get("duration"));
|
||||
}
|
||||
|
||||
@@ -94,10 +115,17 @@ public class TestFailedEvent extends TreeNodeEvent {
|
||||
myLocalizedFailureMessage = localizedFailureMessage;
|
||||
myStacktrace = stackTrace;
|
||||
myTestError = testError;
|
||||
myComparisonFailureActualText = comparisonFailureActualText;
|
||||
myComparisonFailureExpectedText = comparisonFailureExpectedText;
|
||||
myExpectedFilePath = expectedFilePath;
|
||||
if (comparisonFailureExpectedText == null && expectedFilePath != null) {
|
||||
try {
|
||||
comparisonFailureExpectedText = FileUtil.loadFile(new File(expectedFilePath));
|
||||
}
|
||||
catch (IOException ignore) {}
|
||||
}
|
||||
myComparisonFailureActualText = comparisonFailureActualText;
|
||||
|
||||
myActualFilePath = null;
|
||||
myComparisonFailureExpectedText = comparisonFailureExpectedText;
|
||||
myDurationMillis = durationMillis;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user