Skip to content

Commit

Permalink
Comment regex and add README with build instructions.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjust committed Sep 9, 2024
1 parent 6606efc commit d49f444
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions framework/lib/formatter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Custom JUnit test formatter that outputs executed and failing tests, following
# Defects4J's naming conventions for test entries.

Run ant test to compile and test the formatter implementation.

Run ant jar to build and deploy the `formatter.jar`.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ private void handle(Test test, Throwable t) {

className = test.getClass().getName();
{
/*
The expected format for failing tests in Defects4J is:
--- <class name>[::<method name>].
In JUnit, a test's String representation is:
<method name>(<class name>).
In JUnit, a parameterized test's String representation is:
<method name>[<params>](<class name>).
The pattern below extracts only the method name and class name,
stripping the [<params>] part if it exists.
*/
Pattern regexp = Pattern.compile("([^\\[\\(]*)(\\[.*\\])?\\((.*)\\)\\s*");
Matcher match = regexp.matcher(test.toString());
if (match.matches()) {
Expand Down

0 comments on commit d49f444

Please sign in to comment.