1

I'm trying to write an errorformat for JUnit. Directory structure from cwd is:

unsw/piazza/PiazzaForum.java
unsw/piazza/Thread.java
unsw/test/PiazzaTest.java

Amongst all the cruft outputted by JUnit, relevant output lines looks like: unsw.test.PiazzaTest.testSearchByTag(PiazzaTest.java:50)

I capture this with let &errorformat = '%.%#unsw\.test%.%#(%f:%l)' This expects PiazzaTest.java to be in the cwd when it is not.

How can I solve this?

2
  • How would you tell &efm which directory the file is in? I suspect you may be better served by having the output give you the path (I don't use JUnit so can't advise on how to do so). Commented Jun 4, 2021 at 14:58
  • 1
    Possibilities: use %D and %X to handle the package names as directories or post-process JUnit's output (externally w/ script or internally w/ QuickfixCmdPost, see :help QuickfixCmdPost-example)
    – D. Ben Knoble
    Commented Jun 4, 2021 at 18:41

1 Answer 1

1

Although not very flexible:

run-tests.bash:

echo "Entering dir '$(pwd)/unsw/test'" 
java -jar ../lib/junit-platform-console-standalone-1.7.0-M1.jar \
        -cp . --scan-class-path --disable-banner --details=summary
echo "Leaving dir"

.vimrc:

let &errorformat = 
 \ "%.%#unsw\.test%.%#(%f:%l),"
 \. "%DEntering dir '%f',%XLeaving dir,"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.