From 47c216d2e2eadd6e3f344c1131ec12219707249c Mon Sep 17 00:00:00 2001 From: Tim Radvan Date: Sat, 23 Feb 2019 12:02:29 +0000 Subject: [PATCH] Add test for /ui RegExps --- test/test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test.js b/test/test.js index 32345bc..6bafd90 100644 --- a/test/test.js +++ b/test/test.js @@ -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")