Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: correctly test trim-current-directory #176

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions rackunit-test/tests/rackunit/check-info-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
rackunit
rackunit/private/check-info
syntax/srcloc
raco/testing
(submod rackunit/private/check-info for-test))

(module+ test
Expand Down Expand Up @@ -141,19 +142,20 @@
(check-true (check-info-contains-key? info1 'message))
(check-false (check-info-contains-key? info1 'name))))

(test-case "All tests for trim-current-directory"
(test-case "trim-current-directory leaves directories outside the current directory alone"
(check-equal? (trim-current-directory "/foo/bar/") "/foo/bar/"))
(test-equal?
"trim-current-directory strips directory from files in current directory"
(trim-current-directory
(path->string (build-path (current-directory) "foo.rkt")))
"foo.rkt")
(test-equal?
"trim-current-directory leaves subdirectories alone"
(trim-current-directory
(path->string (build-path (current-directory) "foo" "bar.rkt")))
"foo/bar.rkt"))
(parameterize ([current-test-invocation-directory (current-directory)])
(test-case "All tests for trim-current-directory"
(test-case "trim-current-directory leaves directories outside the current directory alone"
(check-equal? (trim-current-directory "/foo/bar/") "/foo/bar/"))
(test-equal?
"trim-current-directory strips directory from files in current directory"
(trim-current-directory
(path->string (build-path (current-directory) "foo.rkt")))
"foo.rkt")
(test-equal?
"trim-current-directory leaves subdirectories alone"
(trim-current-directory
(path->string (build-path (current-directory) "foo" "bar.rkt")))
"foo/bar.rkt")))

(test-case "Do not trample check-info location"
(let ([srcloc #f] [LINE 1][COL 2][POS 3][SPAN 4])
Expand Down