Skip to content

Commit 53b82e1

Browse files
eugen-shulimovibbem
authored andcommitted
test: add a test for comparing unparsed diffs semantically
1 parent f743e2c commit 53b82e1

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

src/test/java/VariationUnparserTest.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void testDiffDir(Path basename) throws IOException, DiffParseException {
5656
}
5757

5858
@Test
59-
public void testDiff() {
59+
public void testTree() {
6060
String source = "";
6161
String temp = "";
6262
try {
@@ -74,6 +74,31 @@ public void testDiff() {
7474
}
7575
}
7676

77+
@Test
78+
public void testDiffSemEq() {
79+
String source = "";
80+
String temp = "";
81+
try {
82+
83+
source = Files
84+
.readString(Path.of("src", "test", "resources", "unparser", "diff", "diff.diff"));
85+
VariationDiff<DiffLinesLabel> diff = VariationDiff.fromDiff(source, VariationDiffParseOptions.Default);
86+
temp = VariationUnparser.variationDiffUnparser(diff);
87+
System.out.println(removeWhitespace(source).equals(removeWhitespace(temp)));
88+
System.out.println(removeWhitespace(VariationUnparser.undiff(source, Time.BEFORE))
89+
.equals(removeWhitespace(VariationUnparser.undiff(temp, Time.BEFORE))));
90+
System.out.println(removeWhitespace(VariationUnparser.undiff(source, Time.AFTER))
91+
.equals(removeWhitespace(VariationUnparser.undiff(temp, Time.AFTER))));
92+
93+
// System.out.println(removeWhitespace(source));
94+
// System.out.println("Ende");
95+
// System.out.println(removeWhitespace(temp));
96+
// System.out.println("Ende");
97+
} catch (Exception e) {
98+
e.printStackTrace();
99+
}
100+
}
101+
77102
public static void testCaseTree(Path testCasePath) {
78103
String temp = "";
79104
try {

0 commit comments

Comments
 (0)