Added test for RegExp literal

This commit is contained in:
sanex3339
2017-06-10 17:30:18 +03:00
parent 68abac764b
commit ea557262ee
2 changed files with 14 additions and 0 deletions
@@ -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\+\)\/;$/);
});
});