www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

test-require.rkt (1096B)


      1 #lang racket
      2 
      3 (require polysemy
      4          rackunit)
      5 
      6 (provide (poly-out [baz identifier-macro match-expander]))
      7 
      8 (require (poly-rename-in "test-provide.rkt"
      9                          [(foo baz) identifier-macro])
     10          (poly-rename-in "test-provide-b.rkt"
     11                          [(bar foo) identifier-macro]
     12                          [(bar baz) match-expander]
     13                          [foo match-expander]))
     14 
     15 (define-poly bar identifier-macro (λ (stx) #'"overridden bar"))
     16 
     17 (check-equal? foo "originally bar")
     18 (check-equal? bar "overridden bar")
     19 (check-equal? baz "originally foo")
     20 
     21 (check-match "originally foo match-expander" (foo))
     22 
     23 (check-equal? (match "something else"
     24                 [(foo) 'bad]
     25                 [_ 'ok])
     26               'ok)
     27 
     28 (check-match "originally bar match-expander" (baz))
     29 
     30 (check-equal? (match "something else"
     31                 [(baz) 'bad]
     32                 [_ 'ok])
     33               'ok)
     34 
     35 (check-equal? (my-macro a aa aaa foo b bb bbb)
     36               '((a aa aaa) (b bb bbb)))
     37 
     38 (check-equal? (my-macro2 a aa aaa foo b bb bbb)
     39               '((a aa aaa) 42 (b bb bbb)))