Skip to content

Commit

Permalink
attempt 2 to fix windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
terzerm committed Feb 7, 2024
1 parent 26981da commit af71fa4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ public static File getTestFile(Class<?> testClass, String testMethod, String fil
}

public static File getTestFile(File parentDir, String testMethod, String fileName, String defaultFileName) {
File file = new File(parentDir, fileName);
File file;
if (OS.Windows.isCurrent()) {
file = (file = new File(parentDir, fileName + ".win")).exists() ? file : new File(parentDir, fileName);
} else {
file = new File(parentDir, fileName);
}
if (!file.exists()) {
if (defaultFileName == null) {
throw new IllegalArgumentException("test file for " + parentDir.getName() + "." + testMethod + " not found, expected file: " + fileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void testLineNumberOnRelativeFiles() throws IOException {
"commuting2.txt:3:Subject: Commuting for beginners.",
Unix4j.use(contextFactory).grep(Grep.Options.lineNumber, "Subject", testFiles).sort()
);
final String urlPathPrefix = "file:" + outputDir.getPath();
final String urlPathPrefix = "file:" + outputDir.getPath().replace('\\', '/');
final Input[] testInputs = new Input[] {
new URLInput(new URL(urlPathPrefix + "/commuting.txt" )),
new URLInput(new URL(urlPathPrefix + "/commuting2.txt" )),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Although there is no requirement that you do so, it is considered good
form to check with an editor

0 comments on commit af71fa4

Please sign in to comment.