Skip to content

Commit 47c216d

Browse files
committed
Add test for /ui RegExps
1 parent 90471f3 commit 47c216d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,16 @@ describe('ignoreCase flag', () => {
12201220
expect(() => compile({ a: /foo/, b: /bar/i, c: "quxx" })).toThrow("If one rule is /i then all must be")
12211221
})
12221222

1223+
test("allows all rules to be /ui", () => {
1224+
expect(() => compile({ a: /foo/ui, b: /bar/ui, c: "quxx" })).not.toThrow()
1225+
expect(() => compile({ a: /foo/u, b: /bar/i, c: "quxx" })).toThrow("If one rule is /i then all must be")
1226+
expect(() => compile({ a: /foo/i, b: /bar/u, c: "quxx" })).toThrow("If one rule is /i then all must be")
1227+
expect(() => compile({ a: /foo/ui, b: /bar/i, c: "quxx" })).toThrow("If one rule is /u then all must be")
1228+
expect(() => compile({ a: /foo/ui, b: /bar/u, c: "quxx" })).toThrow("If one rule is /i then all must be")
1229+
expect(() => compile({ a: /foo/i, b: /bar/ui, c: "quxx" })).toThrow("If one rule is /u then all must be")
1230+
expect(() => compile({ a: /foo/u, b: /bar/ui, c: "quxx" })).toThrow("If one rule is /i then all must be")
1231+
})
1232+
12231233
test("supports ignoreCase", () => {
12241234
const lexer = compile({ a: /foo/i, b: /bar/i, c: "quxx" })
12251235
lexer.reset("FoObArQuXx")

0 commit comments

Comments
 (0)