Skip to content

Commit

Permalink
Add test for /ui RegExps
Browse files Browse the repository at this point in the history
  • Loading branch information
tjvr committed Feb 26, 2019
1 parent 90471f3 commit 47c216d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,16 @@ describe('ignoreCase flag', () => {
expect(() => compile({ a: /foo/, b: /bar/i, c: "quxx" })).toThrow("If one rule is /i then all must be")
})

test("allows all rules to be /ui", () => {
expect(() => compile({ a: /foo/ui, b: /bar/ui, c: "quxx" })).not.toThrow()
expect(() => compile({ a: /foo/u, b: /bar/i, c: "quxx" })).toThrow("If one rule is /i then all must be")
expect(() => compile({ a: /foo/i, b: /bar/u, c: "quxx" })).toThrow("If one rule is /i then all must be")
expect(() => compile({ a: /foo/ui, b: /bar/i, c: "quxx" })).toThrow("If one rule is /u then all must be")
expect(() => compile({ a: /foo/ui, b: /bar/u, c: "quxx" })).toThrow("If one rule is /i then all must be")
expect(() => compile({ a: /foo/i, b: /bar/ui, c: "quxx" })).toThrow("If one rule is /u then all must be")
expect(() => compile({ a: /foo/u, b: /bar/ui, c: "quxx" })).toThrow("If one rule is /i then all must be")
})

test("supports ignoreCase", () => {
const lexer = compile({ a: /foo/i, b: /bar/i, c: "quxx" })
lexer.reset("FoObArQuXx")
Expand Down

0 comments on commit 47c216d

Please sign in to comment.