Skip to content

Commit

Permalink
Test d flag in regexp literal
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Jun 13, 2021
1 parent 9b82783 commit 36e99ab
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
35 changes: 35 additions & 0 deletions tests/format/js/regex/__snapshots__/jsfmt.spec.js.snap
@@ -1,5 +1,40 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`d-flag.js [espree] format 1`] = `
"Invalid regular expression flag (1:2)
> 1 | /./d;
| ^
2 |"
`;

exports[`d-flag.js [flow] format 1`] = `
"Invalid flags supplied to RegExp constructor 'd' (1:5)
> 1 | /./d;
| ^
2 |"
`;

exports[`d-flag.js [meriyah] format 1`] = `
"[1:3]: Unexpected regular expression flag (1:3)
> 1 | /./d;
| ^
2 |"
`;

exports[`d-flag.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
/./d;
=====================================output=====================================
/./d;
================================================================================
`;

exports[`test.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
Expand Down
1 change: 1 addition & 0 deletions tests/format/js/regex/d-flag.js
@@ -0,0 +1 @@
/./d;
8 changes: 7 additions & 1 deletion tests/format/js/regex/jsfmt.spec.js
@@ -1 +1,7 @@
run_spec(__dirname, ["babel", "flow", "typescript"]);
run_spec(__dirname, ["babel", "flow", "typescript"], {
errors: {
flow: ["d-flag.js"],
espree: ["d-flag.js"],
meriyah: ["d-flag.js"],
},
});

0 comments on commit 36e99ab

Please sign in to comment.