Skip to content

Commit 6121114

Browse files
trevoradecopybara-github
authored andcommitted
Make NodeSubject.java directly print the actual JS if the expected JS is empty instead of diffing.
PiperOrigin-RevId: 811391563
1 parent 1a21fc2 commit 6121114

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/com/google/javascript/rhino/testing/NodeSubject.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ public void isEqualToInternal(Node expected, boolean checkJsdoc) {
157157
.expectedText(mismatch.expected.toStringTree())
158158
.actualText(mismatch.actual.toStringTree())
159159
.build());
160+
} else if (expectedOutputJs.trim().isEmpty()) {
161+
// Don't use the text diff fact because everything is new. Avoid prefixing the output with +.
162+
facts.add(
163+
simpleFact(
164+
// Indent by 4 spaces.
165+
"Empty expected JS. Actual JS is:\n " + actualOutputJs.replace("\n", "\n ")));
160166
} else {
161167
facts.addAll(
162168
new TextDiffFactsBuilder("JS diff")

0 commit comments

Comments
 (0)