rackunit
rackunit copied to clipboard
location: adjust path for editors
Running "raco test foo/bar/test.rkt" will cause Racket to change directory to "foo/bar" before invoking "test.rkt", and error messages are printed relative to (current-directory) like
raco test: "foo/bar/test.rkt"
--------------------
fail
FAILURE
name: check-equal?
location: test.rkt:5:0
actual: 1
expected: 2
--------------------
1/1 test failures
For an editor to consume this, it has to post-process the output to correlate "raco test: path" with "location: partial path" (which is difficult when running tests in parallel). This is not ideal; output with
location: foo/bar/test.rkt:5:0
is immediately useable by editors for jumping to the error.
Use the new current-test-invocation-directory to adjust the path better for editors, depending on compiler-lib 1.14. The output now looks like
raco test: "foo/bar/test.rkt"
--------------------
fail
FAILURE
name: check-equal?
location: foo/bar/test.rkt:5:0
actual: 1
expected: 2
--------------------
1/1 test failures
Depends on https://github.com/racket/racket/pull/4988.