racket / rackunit

Other
18 stars 32 forks source link

Bad error with check-match #163

Closed wilbowma closed 8 months ago

wilbowma commented 1 year ago

What version of Racket are you using? 8.7 [cs]

What program did you run?

#lang racket

(require rackunit)

(check-match
 1
 a
 (symbol? a))

(check-match
 `(1)
 `(,a)
 (symbol? a))

(check-match
  'a
  a
 (integer? a))

What should have happened? The user should be able to debug the test failure from the error message.

If you got an error message, please include it here.

--------------------
; FAILURE
;   Source locations:
;   /tmp/meow.rkt:5:0
name:       check-match
location:   meow.rkt:5:0
actual:     1
expected:   'a
--------------------
--------------------
; FAILURE
;   Source locations:
;   /tmp/meow.rkt:10:0
name:       check-match
location:   meow.rkt:10:0
actual:     '(1)
expected:   '`(,a)
--------------------
--------------------
; FAILURE
;   Source locations:
;   /tmp/meow.rkt:16:0
name:       check-match
location:   meow.rkt:16:0
actual:     'a
expected:   'a
--------------------

Please include any other relevant details The error messages we get out of check-match can often be extremely misleading. Consider the above examples, where tests fail apparently claiming that 'a is not equal to 'a (when the read problem is that 'a is not an integer), and that 'a was expected but 1 was produced (when the real problem is that 1 is not a symbol).

I might take a stab at fixing this later if others can't do it faster than me.

capfredf commented 1 year ago

can someone who has permissions help transfer this issue to rackunit