Skip to content

Commit 134f32c

Browse files
Verify looseGroups behavior
1 parent 2471624 commit 134f32c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/longest-prefix.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { assert } from "chai";
12
import { JS } from "refa";
23
import { RegExpParser, visitRegExpAST } from "regexpp";
34
import { Alternative } from "regexpp/ast";
@@ -85,7 +86,16 @@ describe(RAA.getLongestPrefix.name, function () {
8586
);
8687

8788
for (const o of options) {
88-
if (!hasGroups && o.looseGroups) continue;
89+
if (!hasGroups && o.looseGroups) {
90+
const loose = RAA.getLongestPrefix(alternative, direction, flags, o);
91+
const strict = RAA.getLongestPrefix(alternative, direction, flags, {
92+
...o,
93+
looseGroups: false,
94+
});
95+
96+
assert.deepStrictEqual(loose, strict);
97+
continue;
98+
}
8999

90100
const prefix = RAA.getLongestPrefix(alternative, direction, flags, o);
91101

0 commit comments

Comments
 (0)