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

Only immediate test case names are printed in check failures #54

Open
jackfirth opened this issue Jul 2, 2017 · 0 comments
Open

Only immediate test case names are printed in check failures #54

jackfirth opened this issue Jul 2, 2017 · 0 comments
Labels

Comments

@jackfirth
Copy link
Sponsor Collaborator

Given this program:

#lang racket
(require rackunit)
(test-case "foo"
  (test-case "bar"
    (check-equal? 1 2)))

The output is:

--------------------
bar
FAILURE
name:       check-equal?
location:   unsaved-editor:5:4
actual:     1
expected:   2
--------------------

However, if the outer test case is changed to a test suite and run with run-tests the output is:

--------------------
foo > bar
FAILURE
name:       check-equal?
location:   unsaved-editor:6:15
actual:     1
expected:   2
--------------------

I think any (run-tests (test-suite body ...)) expression should have the same output for each check failure / error as the equivalent (test-case body ...) expression. This issue can be fixed by making a (current-test-names) parameter that returns a list of names of all wrapping tests, using #f for unnamed tests. This parameter can be captured by check failure exceptions. Then the logic for printing the test name can be moved out of run-tests and into rackunit/private/format, simplifying the folding that run-tests performs.

@jackfirth jackfirth added the bug label Jul 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant