racket / rackunit

Other
18 stars 32 forks source link

location: adjust path for editors #175

Closed benknoble closed 2 months ago

benknoble commented 2 months ago

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.

benknoble commented 2 months ago

@jackfirth looks like the other PR was merged 🎉

samth commented 2 months ago

It looks like this change broke the following test: http://drdr.racket-lang.org/66750/cs/racket/share/pkgs/rackunit-test/tests/rackunit/check-info-test.rkt

benknoble commented 2 months ago

Thanks Sam; Matthew mentioned that to me, also for http://drdr.racket-lang.org/66749/cs/racket/share/pkgs/rackunit-test/tests/rackunit/check-info-test.rkt

I think what probably happened is the recent fixes to parallel modes caused the problem. I'll take a look as soon as I can.