Skip to content

Commit

Permalink
test: add failing test case for greedy match
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Jan 22, 2024
1 parent 39a0d53 commit 19d7255
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ tap.test('.standardImport() - Multiple import statements on new lines', (t) => {
const str = `
import{ export1 }from "module-a";
import {export2} from"module-b"
import {
import {
export3,
export4,
} from "module-c";
Expand All @@ -190,7 +190,7 @@ tap.test('.standardImport() - Multiple import statements on new lines', (t) => {
tap.test('.standardImport() - Multiple import statements concatinated', (t) => {
const rx = standardImport();
const str = `
import{ export1 }from "module-a";import {export2} from"module-b"import {
import{ export1 }from "module-a";import {export2} from"module-b"import {
export3,
export4,
} from "module-c";
Expand All @@ -211,6 +211,14 @@ tap.test('.standardImport() - Multiple import statements concatinated', (t) => {
t.end();
});

tap.test('.standardImport() - is lazy', (t) => {
const rx = standardImport();
const str = 'imported to know which is which from "f asfasdf asdfasdf asdfasdf adsfasdf"';
const grp = str.match(rx);
t.equal(grp, null, `should not match ${str}`);
t.end();
});

tap.test('.dynamicImport() - Single qoutes', (t) => {
const rx = dynamicImport('m');
const str = 'var promise = import(\'module-name\');';
Expand Down

0 comments on commit 19d7255

Please sign in to comment.