Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: check whether RegExp have the global or sticky flags set (#4742)
* fix: check whether RegExp have the global or sticky flags set * fix: check in hasEffectsOnInteractionAtPath * chore: tweak * chore: tweak variable names
- Loading branch information
Showing
6 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/form/samples/builtin-prototypes/check-tree-shake-on-regexp-if-it-is-used/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
description: 'check tree-shake on RegExp if it is used' | ||
}; |
23 changes: 23 additions & 0 deletions
23
test/form/samples/builtin-prototypes/check-tree-shake-on-regexp-if-it-is-used/_expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const commonRegexp_1 = /1/; | ||
const commonRegexp_2 = /1/; | ||
|
||
assert.strictEqual(commonRegexp_1.test('1'), true); | ||
assert.ok(commonRegexp_2.exec('1')); | ||
|
||
const globalRegexp_1 = /1/g; | ||
const globalRegexp_2 = /1/g; | ||
|
||
globalRegexp_1.test('1'); | ||
globalRegexp_2.exec('1'); | ||
|
||
assert.strictEqual(globalRegexp_1.test('1'), null); | ||
assert.strictEqual(globalRegexp_2.exec('1'), null); | ||
|
||
const stickyRegexp_1 = /1/y; | ||
const stickyRegexp_2 = /1/y; | ||
|
||
stickyRegexp_1.test('1'); | ||
stickyRegexp_2.exec('1'); | ||
|
||
assert.strictEqual(stickyRegexp_1.test('1'), null); | ||
assert.strictEqual(stickyRegexp_2.exec('1'), null); |
26 changes: 26 additions & 0 deletions
26
test/form/samples/builtin-prototypes/check-tree-shake-on-regexp-if-it-is-used/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const commonRegexp_1 = /1/; | ||
const commonRegexp_2 = /1/; | ||
|
||
commonRegexp_1.test('1'); | ||
commonRegexp_2.exec('1'); | ||
|
||
assert.strictEqual(commonRegexp_1.test('1'), true); | ||
assert.ok(commonRegexp_2.exec('1')); | ||
|
||
const globalRegexp_1 = /1/g; | ||
const globalRegexp_2 = /1/g; | ||
|
||
globalRegexp_1.test('1'); | ||
globalRegexp_2.exec('1'); | ||
|
||
assert.strictEqual(globalRegexp_1.test('1'), null); | ||
assert.strictEqual(globalRegexp_2.exec('1'), null); | ||
|
||
const stickyRegexp_1 = /1/y; | ||
const stickyRegexp_2 = /1/y; | ||
|
||
stickyRegexp_1.test('1'); | ||
stickyRegexp_2.exec('1'); | ||
|
||
assert.strictEqual(stickyRegexp_1.test('1'), null); | ||
assert.strictEqual(stickyRegexp_2.exec('1'), null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters