-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AG-28397 Fix issue with modifying
RegExp.$1
value in `log-on-stack-…
…trace` and `abort-on-stack-trace` scriptlets. #384 Squashed commit of the following: commit 0f6b357 Merge: 1ce19f2 aefd3da Author: Adam Wróblewski <adam@adguard.com> Date: Thu Aug 22 13:44:45 2024 +0200 Merge branch 'master' into fix/AG-28397 commit 1ce19f2 Author: Adam Wróblewski <adam@adguard.com> Date: Thu Aug 22 13:42:45 2024 +0200 Fix changelog Rename getRegexpValues to backupRegExpValues Rename setPreviousRegExpValues to restoreRegExpValues Log error Add test for backupRegExpValues commit 579b9d9 Author: Adam Wróblewski <adam@adguard.com> Date: Thu Aug 22 11:59:59 2024 +0200 Change null to void commit ecb91de Author: Adam Wróblewski <adam@adguard.com> Date: Thu Aug 22 10:55:31 2024 +0200 Fix issue with modifying `RegExp.$1` value in `log-on-stack-trace` and `abort-on-stack-trace` scriptlets
- Loading branch information
Showing
17 changed files
with
232 additions
and
1 deletion.
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
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
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
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
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
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
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
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,40 @@ | ||
import { restoreRegExpValues, backupRegExpValues } from '../../src/helpers'; | ||
|
||
test('restoreRegExpValues() check if correct value have been set', async () => { | ||
restoreRegExpValues(['foo']); | ||
expect(RegExp.$1).toBe('foo'); | ||
expect(RegExp.$2).toBe(''); | ||
}); | ||
|
||
test('restoreRegExpValues() check if correct values have been set', async () => { | ||
restoreRegExpValues(['test', 'abc', 'xyz', 'aaaa', '123']); | ||
expect(RegExp.$1).toBe('test'); | ||
expect(RegExp.$2).toBe('abc'); | ||
expect(RegExp.$3).toBe('xyz'); | ||
expect(RegExp.$4).toBe('aaaa'); | ||
expect(RegExp.$5).toBe('123'); | ||
expect(RegExp.$6).toBe(''); | ||
}); | ||
|
||
test('backupRegExpValues() and restoreRegExpValues(), modify values and restore them', async () => { | ||
const regExp = /(\w+)\s(\w+)/; | ||
const string = 'div a'; | ||
string.replace(regExp, '$2, $1'); | ||
|
||
expect(RegExp.$1).toBe('div'); | ||
expect(RegExp.$2).toBe('a'); | ||
|
||
const backupRegexp = backupRegExpValues(); | ||
|
||
const regExp2 = /(\w+)\s(\w+)/; | ||
const string2 = 'qwerty zxcvbn'; | ||
string2.replace(regExp2, '$2, $1'); | ||
|
||
expect(RegExp.$1).toBe('qwerty'); | ||
expect(RegExp.$2).toBe('zxcvbn'); | ||
|
||
restoreRegExpValues(backupRegexp); | ||
|
||
expect(RegExp.$1).toBe('div'); | ||
expect(RegExp.$2).toBe('a'); | ||
}); |
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
Oops, something went wrong.