Skip to content

Commit e20ed10

Browse files
committed
More regexp character tests (negative cases)
1 parent fce947f commit e20ed10

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

clj/test/syntax_test.clj

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
(defn all [kw] (partial every? (partial = kw)))
55
(def number (all :clojureNumber))
66
(def !number (complement number))
7-
(def character (all :clojureCharacter))
87
(def regexp (all :clojureRegexp))
8+
(def !regexp (complement regexp))
99
(def regexp-escape (all :clojureRegexpEscape))
10+
(def !regexp-escape (complement regexp-escape))
1011

1112
(defsyntaxtest number-literals-test
1213
(with-format "%s"
@@ -74,36 +75,48 @@
7475
;;
7576
;; Characters
7677
;; x The character x
77-
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" regexp
78+
" 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" regexp
7879
"λ❤" regexp
7980
;; \\ The backslash character
8081
"\\\\" regexp-escape
8182
;; \0n The character with octal value 0n (0 <= n <= 7)
8283
"\\07" regexp-escape
84+
"\\08" !regexp-escape
8385
;; \0nn The character with octal value 0nn (0 <= n <= 7)
8486
"\\077" regexp-escape
87+
"\\078" !regexp-escape
8588
;; \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7)
8689
"\\0377" regexp-escape
90+
"\\0378" !regexp-escape
91+
"\\0400" !regexp-escape
8792
;; \xhh The character with hexadecimal value 0xhh
8893
"\\xff" regexp-escape
94+
"\\xfg" !regexp-escape
95+
"\\xfff" !regexp-escape
8996
;; \uhhhh The character with hexadecimal value 0xhhhh
9097
"\\uffff" regexp-escape
98+
"\\ufff" !regexp-escape
99+
"\\ufffff" !regexp-escape
91100
;; \x{h...h} The character with hexadecimal value 0xh...h (Character.MIN_CODE_POINT <= 0xh...h <= Character.MAX_CODE_POINT)
92-
"\\x{ffff}" regexp-escape
93101
;; \t The tab character ('\u0009')
94102
"\\t" regexp-escape
103+
"\\T" !regexp-escape
95104
;; \n The newline (line feed) character ('\u000A')
96105
"\\n" regexp-escape
106+
"\\N" !regexp-escape
97107
;; \r The carriage-return character ('\u000D')
98108
"\\r" regexp-escape
109+
"\\R" !regexp-escape
99110
;; \f The form-feed character ('\u000C')
100111
"\\f" regexp-escape
112+
"\\F" !regexp-escape
101113
;; \a The alert (bell) character ('\u0007')
102114
"\\a" regexp-escape
115+
"\\A" !regexp-escape
103116
;; \e The escape character ('\u001B')
104117
"\\e" regexp-escape
118+
"\\E" !regexp-escape
105119
;; \cx The control character corresponding to x
106-
"\\cF" regexp-escape
107120
;;
108121
;; Character classes
109122
;; [abc] a, b, or c (simple class)

0 commit comments

Comments
 (0)