(load-relative "../char-set-literals.scm") (import char-set-literals) (use test srfi-14 srfi-1) (define-syntax test-char-set (syntax-rules () ((_ literal cs ...) (test literal (list->char-set (append-map (lambda (c) (if (pair? c) (char-set->list (ucs-range->char-set (char->integer (car c)) (add1 (char->integer (cdr c))))) (list c))) (list cs ...))) (cadr (with-input-from-string (substring literal 2) read-char-set-literal)))))) (test-char-set "#[f-x]" '(#\f . #\x)) (test-char-set "#[0-9]" '(#\0 . #\9)) (test-char-set "#[a-z0-9]" '(#\a . #\z) '(#\0 . #\9)) (test-char-set "#[\x21-\x7e]" '(#\x21 . #\x7e)) (test-char-set "#[()<>@,;:\\\\\"/\\[\\]?=]" #\( #\) #\< #\> #\@ #\, #\; #\: #\\ #\" #\/ #\[ #\] #\? #\=) (test-char-set "#[!-<>-~]" '(#\! . #\<) '(#\> . #\~)) (test-char-set "#[\"]" #\") (test-char-set "#[a-]" #\a #\-) (test-char-set "#[-]" #\-) (test-char-set "#[-a]" #\a #\-)