test-call-with-dotted-last.rkt (527B)
1 #lang racket 2 3 (require generic-syntax-expanders 4 (for-syntax syntax/parse) 5 rackunit) 6 7 (define-expander-type foo) 8 9 (define-foo-expander some-foo-expander 10 (syntax-parser 11 [(_ a:id b:id c:id . d:id) #'(d c b a)])) 12 13 (define-syntax (test-foo-expander stx) 14 (syntax-parse stx 15 [(_ e:expr) 16 #`'#,(expand-all-foo-expanders #'e)])) 17 18 (test-equal? 19 "Check that some-foo-expander accepts being called 20 when it is the first item of a dotted list" 21 (test-foo-expander (some-foo-expander x y z . t)) 22 '(t z y x))