Skip to content

Commit

Permalink
JS: Add: Test case for checking if regex via using splice
Browse files Browse the repository at this point in the history
  • Loading branch information
Napalys committed Nov 14, 2024
1 parent 84234d5 commit 52330e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
| tst.js:1:12:1:38 | '^http: ... le.com' | is a regular expression |
| tst.js:4:37:4:43 | 'regex' | is a regular expression |
4 changes: 4 additions & 0 deletions javascript/ql/test/library-tests/RegExp/IsRegex/IsRegex.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import javascript

from RegExpPatternSource regex
select regex, "is a regular expression"
6 changes: 6 additions & 0 deletions javascript/ql/test/library-tests/RegExp/IsRegex/tst.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
new RegExp('^http://test\.example.com'); // NOT OK

function detectRegexViaSplice(string) {
let found = getMyThing().search('regex'); // NOT OK
arr.splice(found, 1);
};

0 comments on commit 52330e8

Please sign in to comment.