···
361
+
describe('non-capturing shorthand', () => {
362
+
const node = match('node')`${/1/} :${/2/}+`;
364
+
input | result | lastIndex
365
+
${'12'} | ${['1']} | ${2}
366
+
${'122'} | ${['1']} | ${3}
367
+
${'13'} | ${undefined} | ${0}
368
+
${'1'} | ${undefined} | ${0}
369
+
${'_'} | ${undefined} | ${0}
371
+
'should return $result when $input is passed',
372
+
({ input, result, lastIndex }) => {
373
+
expectToParse(node, input, result, lastIndex);
describe('non-capturing group with plus matcher, then required matcher', () => {
const node = match('node')`(?: ${/1/}+) ${/2/}`;
···
465
+
describe('positive lookahead shorthand', () => {
466
+
const node = match('node')`=${/1/} ${/\d/}`;
468
+
input | result | lastIndex
469
+
${'1'} | ${['1']} | ${1}
470
+
${'13'} | ${['1']} | ${1}
471
+
${'2'} | ${undefined} | ${0}
472
+
${'_'} | ${undefined} | ${0}
474
+
'should return $result when $input is passed',
475
+
({ input, result, lastIndex }) => {
476
+
expectToParse(node, input, result, lastIndex);
describe('positive lookahead group with plus matcher', () => {
const node = match('node')`(?= ${/1/}+) ${/\d/}`;
···
describe('negative lookahead group', () => {
const node = match('node')`(?! ${/1/}) ${/\d/}`;
521
+
input | result | lastIndex
522
+
${'2'} | ${['2']} | ${1}
523
+
${'23'} | ${['2']} | ${1}
524
+
${'1'} | ${undefined} | ${0}
525
+
${'1'} | ${undefined} | ${0}
526
+
${'_'} | ${undefined} | ${0}
528
+
'should return $result when $input is passed',
529
+
({ input, result, lastIndex }) => {
530
+
expectToParse(node, input, result, lastIndex);
535
+
describe('negative lookahead shorthand', () => {
536
+
const node = match('node')`!${/1/} ${/\d/}`;
input | result | lastIndex