jmborer commented on a change in pull request #1042: Update
TestOutputListenerProvider.java to fix [NETBEANS-635]
URL:
https://github.com/apache/incubator-netbeans/pull/1042#discussion_r237415820
##########
File path:
java/maven/src/org/netbeans/modules/maven/output/TestOutputListenerProvider.java
##########
@@ -81,13 +81,13 @@
/** Creates a new instance of TestOutputListenerProvider */
public TestOutputListenerProvider() {
- failSeparatePattern = Pattern.compile("(?:\\[surefire\\] )?Tests
run.*[<]* FAILURE[!]*(.*)", Pattern.DOTALL); //NOI18N
- failWindowsPattern1 = Pattern.compile("(?:\\[surefire\\] )?Tests
run.*", Pattern.DOTALL); //NOI18N
- failWindowsPattern2 = Pattern.compile(".*[<]* FAILURE [!]*.*",
Pattern.DOTALL); //NOI18N
- runningPattern = Pattern.compile("(?:\\[surefire\\] )?Running (.*)",
Pattern.DOTALL); //NOI18N
- outDirPattern = Pattern.compile(".*(?:Surefire)?(?:Failsafe)? report
directory\\: (.*)", Pattern.DOTALL); //NOI18N
- outDirPattern2 = Pattern.compile(".*Setting reports dir\\: (.*)",
Pattern.DOTALL); //NOI18N
- runningPattern2 =
Pattern.compile("^---\\smaven-surefire-plugin:\\d+\\.\\d+:test\\s.*$",
Pattern.DOTALL);
+ failSeparatePattern =
Pattern.compile("(?:\\[[a-zA-Z]+\\])?\\s*(?:\\[surefire\\] )?Tests run.*[<]*
FAILURE[!]*(.*)", Pattern.DOTALL); //NOI18N
+ failWindowsPattern1 =
Pattern.compile("(?:\\[[a-zA-Z]+\\])?\\s*(?:\\[surefire\\] )?Tests run.*",
Pattern.DOTALL); //NOI18N
+ failWindowsPattern2 = Pattern.compile("(?:\\[[a-zA-Z]+\\])?.*[<]*
FAILURE [!]*.*", Pattern.DOTALL); //NOI18N
+ runningPattern =
Pattern.compile("(?:\\[[a-zA-Z]+\\])?\\s*(?:\\[surefire\\] )?Running (.*)",
Pattern.DOTALL); //NOI18N
+ outDirPattern =
Pattern.compile("(?:\\[[a-zA-Z]+\\])?\\s*(?:Surefire)?(?:Failsafe)? report
directory\\: (.*)", Pattern.DOTALL); //NOI18N
+ outDirPattern2 = Pattern.compile("(?:\\[[a-zA-Z]+\\])?\\s*Setting
reports dir\\: (.*)", Pattern.DOTALL); //NOI18N
+ runningPattern2 =
Pattern.compile("(?:\\[[a-zA-Z]+\\])?\\s*---\\smaven-surefire-plugin:\\d+(?:.\\d+)+[-_a-zA-Z0-9]*:test\\s.*",
Pattern.DOTALL);
Review comment:
> Does the - in the [-_a-zA-Z0-9] not need to be escaped?
No. It works. I have tested it. [\-_a-zA-Z0-9] would have worked too. You
can try it yourself with the expression below if you want:
`[INFO] --- maven-surefire-plugin:3.0.0-M_1:test (default-test) @
mavenproject3 ---`
> Also is it safe to remove the ^ and $ from this pattern?
I think so, because you read lines anyway. I would even say it is more
robust in case something is added to the line before or after for any reason.
Again I did many "live" tests and it always worked.
The parsing is now much better than before (supports at least 2.18, 2.19 ->
3.0+ versions)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists