anaphoric/test/aand-test.rkt
2018-08-24 00:32:40 +02:00

35 lines
789 B
Racket

#lang racket
(require anaphoric/aand
rackunit)
(define lst '(x b 2 y z a b c 1 2 3))
(check-equal? (aand)
#t)
(check-equal? (aand #f)
#f)
(check-equal? (aand (member 'y lst))
'(y z a b c 1 2 3))
(check-equal? (aand (member 'y lst)
(member 'b lst)
(member '2 lst))
'(2 y z a b c 1 2 3))
(check-equal? (aand (member 'y lst)
(member 'b lst)
(member '2 it))
'(2 y z a b c 1 2 3))
(check-equal? (aand (member 'y lst)
(member 'b it)
(member '2 it))
'(2 3))
(check-equal? (aand (member 'absent lst)
(fail "aand selected wrong branch"))
#f)