#lang racket (require rackunit rackunit/text-ui "bcond.rkt") (run-tests (test-suite "bcond tests" (test-equal? "skip false" (bcond [#f 1] [#t 2]) 2) (test-equal? "else" (bcond [#f 1] [else 2]) 2) (test-equal? "fall off end" (bcond [#f 1]) (void)) (test-equal? "single-term clause" (bcond [#f] [2] [3]) 2) (test-equal? "implicit begin" (let* ([x 0] [y (bcond [#f 1] [#t (set! x 3) 2])]) (list x y)) (list 3 2)) (test-equal? "arrow clause" (bcond [#f 1] [1 => add1]) 2) (test-equal? "no premature evaluation" (bcond [#t 1] [#t (error 'test "should not be evaluated")]) 1) (test-equal? "let" (bcond [#f 1] [let x 2] [#t (+ 1 x)]) 3) (test-equal? "correct scope" (let ([x 0]) (bcond [#f 1] [#t x] [let x 3] [else x])) 0) (test-equal? "let-values" (bcond [#f 1] [let-values (x y) (values 1 2)] [#t (+ x y)]) 3)))