How to use check-expect in Racket

racket, scheme

Solution

Old question, but answer for the googlers:

You can `(require test-engine/racket-tests)`, which defines `check-expect`.

Note that, unlike BSL, you'll have to run the tests with `(test)`.

Problem

I am trying to use the check-expect function in scheme but I keep being told its an unbound identifier for check-expect. Isn't check-expect a function I can use already? Below is my code: ``` #lang racket (define contains (lambda (item list*) (if (equal? list* '()) #f (if (equal? item (car list*)) #t (contains item (cdr list*)))))) (define z (list 1 2 3)) (define q (list 4 5 6)) (define p (list "apple" "orange" "carrot")) (check-expect (contains 1 z) #t) ```

Original source