syntax/parse: compress test, add more variants

This commit is contained in:
Ryan Culpepper 2017-02-01 20:03:16 -05:00
parent 68bd27707d
commit febf3f36d7

View File

@ -803,30 +803,30 @@
(vector-immutable 1 (s-3d) 3) (vector-immutable 1 (s-3d) 3)
(list 'a (s-3d) 'c)])) (list 'a (s-3d) 'c)]))
(test-case "Regression test for Github issue #1602" ;; from Alex Knauth, issue #1602 (2/2017)
(define-syntax-class stuff (let ()
[pattern (2 :three)])
;; a splicing syntax class for just 3
(define-splicing-syntax-class three (define-splicing-syntax-class three
[pattern 3]) [pattern 3])
(define-syntax-class stuff
;; like stuff, but with an extra attribute [pattern (2 :three)])
;; like stuff, but with an extra attribute (adds ORD progress frame)
(define-syntax-class stuff* (define-syntax-class stuff*
[pattern :stuff #:with random-attr 'whocares]) [pattern :stuff #:with random-attr 'whocares])
(terx (1 2 wrong)
(define wrong* #'wrong) (1 . :stuff*)
#rx"expected the literal 3"
#rx"at: wrong"))
(define (exn:expected-literal-3-at-wrong? e) ;; more #1602 tests
(match e (terx (1 2)
[(exn:fail:syntax (regexp #rx".*expected the literal 3.*") (a . (~post (b c)))
_ #rx"expected more terms starting with any term")
(list (== wrong* bound-identifier=?))) (terx (1 2)
#true] (a . (~and (_ . _) (b c)))
[_ (println e) #false])) #rx"expected more terms starting with any term")
(terx #(1 2)
(check-exn exn:expected-literal-3-at-wrong? #(a b c)
(λ () #rx"expected more terms starting with any term")
(syntax-parse #`(1 2 #,wrong*) (terx #s(point 1)
[(1 . :stuff*) #s(point a b)
'body])))) #rx"expected more terms starting with any term")