Skip to content

Commit

Permalink
feat(objectionary#2674): fix tests for windows test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanich96 committed Dec 26, 2023
1 parent 5e0ff0a commit d421039
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void detectsErrorsSuccessfully(
);
final String parse = this.parserMessage(out, "Errors identified:");
Assertions.assertTrue(
parse.matches(temp.resolve("foo/x/main.eo").toString().concat(", \\d+")),
parse.matches(this.createRegEx(temp)),
"Errors message should have program name and error line number"
);
}
Expand All @@ -99,7 +99,7 @@ void detectsCriticalErrorsSuccessfully(
);
final String parse = this.parserMessage(out, "Critical error identified:");
Assertions.assertTrue(
parse.matches(temp.resolve("foo/x/main.eo").toString().concat(", \\d+")),
parse.matches(this.createRegEx(temp)),
"Critical error message should have program name and error line number"
);
}
Expand All @@ -124,7 +124,7 @@ void detectsWarningWithCorrespondingFlag(
);
final String parse = this.parserMessage(out, "Warnings identified:");
Assertions.assertTrue(
parse.matches(temp.resolve("foo/x/main.eo").toString().concat(", \\d+")),
parse.matches(this.createRegEx(temp)),
"Warnings message should have program name and error line number"
);
}
Expand Down Expand Up @@ -256,4 +256,14 @@ private String parserMessage(final Logs logs, final String error) {
final String result = message.substring(message.indexOf(str) + str.length());
return result.substring(0, result.indexOf(": "));
}

/**
* Create regular expression for testing.
* @param path Path program
*/
private String createRegEx(final Path path) {
return path.resolve("foo/x/main.eo")
.toString().replace("\\", "\\\\")
.concat(", \\d+");
}
}

0 comments on commit d421039

Please sign in to comment.