diff --git a/test/regexp-fail.rkt b/test/regexp-fail.rkt index 42cbf0f..9168bbb 100644 --- a/test/regexp-fail.rkt +++ b/test/regexp-fail.rkt @@ -33,6 +33,11 @@ (define rx "he(l*)(o*)") (regexp-match: rx "helloooooooo")) (U #f (List String String String))) + ;; -- set! problems + (ann (let-regexp: ([a #rx"(b)(B)"]) + (set! a #rx"") + (regexp-match: a "hai")) + (List String String String)) ;; --- Can't handle |, yet (ann (regexp-match: "this(group)|that" "that") (U #f (List String String))) diff --git a/test/regexp-pass.rkt b/test/regexp-pass.rkt index a8004ad..c9e165a 100644 --- a/test/regexp-pass.rkt +++ b/test/regexp-pass.rkt @@ -8,6 +8,24 @@ trivial/regexp typed/rackunit) + ;; -- set! ruins everything + (check-equal? + (ann + (let () + (define-regexp: a #rx"h(i)") + (set! a #rx"hi") + (regexp-match a "hi")) + (U #f (Pairof String (Listof (U #f String))))) + (list "hi")) + + (check-equal? + (ann + (let-regexp: ([a #rx"h(i)"]) + (set! a #rx"(h)(i)") + (regexp-match a "hi")) + (U #f (Pairof String (Listof (U #f String))))) + (list "hi" "h" "i")) + ;; -- regexp-match: (check-equal? (ann