www

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

test-syntax-case-as-syntax-parse.rkt (459B)


      1 #lang racket/base
      2 (require rackunit
      3          subtemplate/private/syntax-case-as-syntax-parse
      4          stxparse-info/parse)
      5 (check-equal?
      6  (syntax-parse #'(1 2 3)
      7    [{~syntax-case (~var ... ~and)}
      8     (list (map syntax->datum (attribute ~var))
      9           (syntax->datum (attribute ~and)))
     10     ])
     11  '((1 2) 3))
     12 
     13 (check-equal?
     14  (syntax-parse #'(1 2 3)
     15    [{~syntax-case (... (_ _ _))}
     16     ;; underscores are not escaped by (... pat)
     17     (syntax->datum #'_)])
     18  '_)