Skip to content

Commit 0e63ea1

Browse files
author
Max Schaefer
committed
JavaScript: Update tests.
1 parent 659c67c commit 0e63ea1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

javascript/ql/test/query-tests/RegExp/IdentityReplacement/IdentityReplacement.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@
22
| tst.js:1:13:1:16 | "\\\\" | This replaces '\\' with itself. |
33
| tst.js:2:13:2:18 | /(\\\\)/ | This replaces '\\' with itself. |
44
| tst.js:3:13:3:17 | /["]/ | This replaces '"' with itself. |
5+
| tst.js:6:13:6:18 | /foo/g | This replaces 'foo' with itself. |
6+
| tst.js:9:13:9:17 | /^\\\\/ | This replaces '\\' with itself. |
7+
| tst.js:10:13:10:17 | /\\\\$/ | This replaces '\\' with itself. |
8+
| tst.js:11:13:11:18 | /\\b\\\\/ | This replaces '\\' with itself. |
9+
| tst.js:12:13:12:18 | /\\B\\\\/ | This replaces '\\' with itself. |
10+
| tst.js:13:13:13:22 | /\\\\(?!\\\\)/ | This replaces '\\' with itself. |
11+
| tst.js:14:13:14:23 | /(?<!\\\\)\\\\/ | This replaces '\\' with itself. |
12+
| tst.js:16:13:16:15 | /^/ | This replaces the empty string with itself. |

javascript/ql/test/query-tests/RegExp/IdentityReplacement/tst.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,15 @@ raw.replace("\\", "\\"); // NOT OK
22
raw.replace(/(\\)/, "\\"); // NOT OK
33
raw.replace(/["]/, "\""); // NOT OK
44
raw.replace("\\", "\\\\"); // OK
5+
6+
raw.replace(/foo/g, 'foo'); // NOT OK
7+
raw.replace(/foo/gi, 'foo'); // OK
8+
9+
raw.replace(/^\\/, "\\"); // NOT OK
10+
raw.replace(/\\$/, "\\"); // NOT OK
11+
raw.replace(/\b\\/, "\\"); // NOT OK
12+
raw.replace(/\B\\/, "\\"); // NOT OK
13+
raw.replace(/\\(?!\\)/, "\\"); // NOT OK
14+
raw.replace(/(?<!\\)\\/, "\\"); // NOT OK
15+
16+
raw.replace(/^/, ""); // NOT OK

0 commit comments

Comments
 (0)