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

the exception handling in check-equal? catches exn:break? exceptions and it probably shouldn't #121

Open
rfindler opened this issue Jun 9, 2020 · 2 comments

Comments

@rfindler
Copy link
Member

rfindler commented Jun 9, 2020

I think that exn:break? exceptions should not be caught by rackunit's exception handling mechanism. They shouldn't count as a failed test due to an error, they should just be unhandled as a break by the program. Below is an example program (that can be turned into a test case by, say, catching stderr) that, IMO, should behave differently.

#lang racket

(require rackunit)

(define s (make-semaphore))
(define t
  (thread
   (λ ()
     (check-equal? (let ()
                     (semaphore-post s)
                     (semaphore-wait (make-semaphore 0)))
                   5))))
(semaphore-wait s)
(break-thread t)
@AlexKnauth
Copy link
Member

AlexKnauth commented Jun 9, 2020

I think this is caused by default-check-around's use of (with-handlers ([(λ (_) #t) ....]) ....) in rackunit/private/check line 70

(with-handlers ([(λ (_) #t) log-and-handle!])

And possibly other with-handlers catch-all clauses in other implementations of check-around functions or test-case-around functions that catch exceptions like this.

@rfindler
Copy link
Member Author

rfindler commented Jun 9, 2020

(In case it wasn't clear, I think that should be exn:fail? not the constant true function.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants