mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Added test for RegExp literal
This commit is contained in:
+13
@@ -196,4 +196,17 @@ describe('LiteralTransformer', () => {
|
||||
|
||||
assert.match(obfuscationResult.getObfuscatedCode(), /^var *test *= *0x0;$/);
|
||||
});
|
||||
|
||||
it('should keep safe value of RegExp literal', () => {
|
||||
let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
|
||||
readFileAsString(__dirname + '/fixtures/regexp-literal.js'),
|
||||
{
|
||||
...NO_CUSTOM_NODES_PRESET,
|
||||
stringArray: true,
|
||||
stringArrayThreshold: 1
|
||||
}
|
||||
);
|
||||
|
||||
assert.match(obfuscationResult.getObfuscatedCode(), /^var *regExp *= *\/\(\\d\+\)\/;$/);
|
||||
});
|
||||
});
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
var regExp = /(\d+)/;
|
||||
Reference in New Issue
Block a user