Demonstrates bug in char-complement.

This commit adds 3 tests. All 3 should pass, but right now 2 of them
fail because char-complement is considering (repetition n n e) to be
a charset for *any* n, so long as e is a charset.
pull/6/head
Jesse A. Tov 5 years ago committed by Matthew Butterick
parent 8752bf5bfb
commit 0eecc81e6c

@ -147,6 +147,7 @@
(check-equal? (char-set? '(repetition 1 2 #\1)) #f) (check-equal? (char-set? '(repetition 1 2 #\1)) #f)
(check-equal? (char-set? '(repetition 1 1 "12")) #f) (check-equal? (char-set? '(repetition 1 1 "12")) #f)
(check-equal? (char-set? '(repetition 1 1 "1")) #t) (check-equal? (char-set? '(repetition 1 1 "1")) #t)
(check-equal? (char-set? '(repetition 6 6 "1")) #f)
(check-equal? (char-set? '(union "1" "2" "3")) #t) (check-equal? (char-set? '(union "1" "2" "3")) #t)
(check-equal? (char-set? '(union "1" "" "3")) #f) (check-equal? (char-set? '(union "1" "" "3")) #f)
(check-equal? (char-set? '(intersection "1" "2" (union "3" "4"))) #t) (check-equal? (char-set? '(intersection "1" "2" (union "3" "4"))) #t)
@ -182,4 +183,8 @@
(check-equal? (parse #'(char-range #\1 "1") null) '(char-range #\1 #\1)) (check-equal? (parse #'(char-range #\1 "1") null) '(char-range #\1 #\1))
(check-equal? (parse #'(char-range "1" "3") null) '(char-range #\1 #\3)) (check-equal? (parse #'(char-range "1" "3") null) '(char-range #\1 #\3))
(check-equal? (parse #'(char-complement (union "1" "2")) null) (check-equal? (parse #'(char-complement (union "1" "2")) null)
'(char-complement (union "1" "2")))) '(char-complement (union "1" "2")))
(check-equal? (parse #'(char-complement (repetition 1 1 "1")) null)
'(char-complement (repetition 1 1 "1")))
(check-exn #rx"not a character set"
(λ () (parse #'(char-complement (repetition 6 6 "1")) null))))

Loading…
Cancel
Save