racket / rackunit

Other
18 stars 32 forks source link

tests: correctly test trim-current-directory #176

Closed benknoble closed 2 months ago

benknoble commented 2 months ago

Now that current-test-invocation-directory is set in parallel mode, this test case fails in DrDr environments with something like

--------------------
trim-current-directory strips directory from files in current directory
FAILURE
name:       check-equal?
location: /opt/plt/builds/<current-rev>/trunk/racket/share/pkgs/rackunit-test/tests/rackunit/check-info-test.rkt:147:4
actual: "/opt/plt/builds/<current-rev>/trunk/racket/share/pkgs/rackunit-test/tests/rackunit/foo.rkt"
expected:   "foo.rkt"
--------------------
--------------------
trim-current-directory leaves subdirectories alone
FAILURE
name:       check-equal?
location: /opt/plt/builds/<current-rev>/trunk/racket/share/pkgs/rackunit-test/tests/rackunit/check-info-test.rkt:152:4
actual: "/opt/plt/builds/<current-rev>/trunk/racket/share/pkgs/rackunit-test/tests/rackunit/foo/bar.rkt"
expected:   "foo/bar.rkt"
--------------------

Instead of trying to make the tests deal with DrDr's environment, set the current-test-invocation-directory for these tests to the current-directory. In other words: when testing the tester, work around the (meta?) tester to be properly agnostic.

Best viewed with: --ignore--all-space

This should fixup comments on https://github.com/racket/rackunit/pull/175#issuecomment-2122874170.