Skip to content

Commit e96548e

Browse files
committed
Expect a platform path in the git diff parsing test
With the fixture read as LF, the second Windows run parsed both files, and the test failed only on how it wrote the expected path: SingleFileDiff keeps a Path, which prints with backslashes on Windows. The expected string now builds that path with Path.of, so it prints the platform's way on every system.
1 parent a60e060 commit e96548e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎gradle-open-java-format/src/test/java/com/palantir/javaformat/gradle/FormatDiffTest.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ void parsing_git_diff_output_works() throws IOException {
6262
assertThat(strings)
6363
.containsExactly(
6464
"SingleFileDiff{path=build.gradle, lineRanges=[[24..25), [29..30)]}",
65-
"SingleFileDiff{path=tracing/src/test/java/com/palantir/tracing/TracersTest.java, "
66-
+ "lineRanges=[[659..660), [675..676)]}");
65+
// The path is a Path, which prints with backslashes on Windows.
66+
"SingleFileDiff{path=" + Path.of("tracing/src/test/java/com/palantir/tracing/TracersTest.java")
67+
+ ", lineRanges=[[659..660), [675..676)]}");
6768
}
6869

6970
@ParameterizedTest

0 commit comments

Comments
 (0)