William J. Bowman
unread,Feb 23, 2021, 1:19:04 AM2/23/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Racket Users
Below is an example that behaves "correctly", as in all tests run and are
counted as failured or errors correctly, in Racket 7.8, but which crashes in
Racket 8.
> #lang racket
>
> (require
> rackunit
> rackunit/log)
>
> (define (suite1)
> (test-suite
> ""
> (test-begin
> (check-not-equal? (error "actual") (error "expected")))))
>
> (define (suite2)
> (test-suite
> ""
> (check-not-equal? (error "actual") (error "expected"))))
>
> (module+ test
> (require rackunit/text-ui)
>
> ;; Correctly counts the tests as errors in 7.8 and 8.0
> (check-pred
> integer?
> (run-tests (suite1)))
>
> ;; Counts the tests as errors in 7.8, but crashes in 8.0
> (check-pred
> integer?
> (run-tests (suite2)))
>
> ;; Gets run in 7.8, but not in 8.0
> (check-equal? 0 0))
This has something to do with when test-suite delays a test, which seems
inconsistent across the Racket versions.
I'm not sure whether the problem was some undefined behaviour in test-suite or
not.
I'm a bit confused about the semantics of test-suites and tests, since the
documentation claims a test (unlike a check) is delayed, yet test-case and
test-begin do not delay tests, while test-suite does produce a delayed suite of
tests.
However, test-begin DOES seem to delay a test in the context of a test-suite.
I'd appreciate any insight.
--
William J. Bowman