gnodet-bot commented on code in PR #387:
URL: https://github.com/apache/maven-filtering/pull/387#discussion_r4093487506
##########
src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java:
##########
@@ -146,4 +146,10 @@ void escapeWindowsPathNotAtBeginning() {
"jdbc:derby:C:\\\\Users\\\\Administrator/test;create=true",
FilteringUtils.escapeWindowsPath("jdbc:derby:C:\\Users\\Administrator/test;create=true"));
}
+
+ @Test
+ void relativeFilePathStripsLeadingSeparatorFromWindowsDrivePath() {
+ assertEquals("file.txt", FilteringUtils.getRelativeFilePath("C:/base",
"/C:/base/file.txt"));
+ assertEquals("../other/file.txt",
FilteringUtils.getRelativeFilePath("/C:/base/dir", "C:/base/other/file.txt"));
Review Comment:
⚠️ **Windows CI failure** — This assertion hardcodes forward slashes but
`getRelativeFilePath` uses `File.separatorChar` internally, so on Windows the
result contains backslashes (`..\other\file.txt`). CI confirms this.
Fix: normalize the result (or the expected value) using `File.separator`:
```suggestion
assertEquals("../other/file.txt".replace('/', File.separatorChar),
FilteringUtils.getRelativeFilePath("/C:/base/dir",
"C:/base/other/file.txt"));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]