Skip to content

Commit c637b6f

Browse files
committed
JS: Update test for RegExpAlwaysMatches
1 parent 9df9ca2 commit c637b6f

File tree

1 file changed

+5
-5
lines changed
  • javascript/ql/test/query-tests/RegExp/RegExpAlwaysMatches

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,23 @@ function emptyAlt3(x) {
5555
}
5656

5757
function search(x) {
58-
return x.search(/[a-z]*/); // NOT OK
58+
return x.search(/[a-z]*/) > -1; // NOT OK
5959
}
6060

6161
function search2(x) {
62-
return x.search(/[a-z]/); // OK
62+
return x.search(/[a-z]/) > -1; // OK
6363
}
6464

6565
function lookahead(x) {
66-
return x.search(/(?!x)/); // OK
66+
return x.search(/(?!x)/) > -1; // OK
6767
}
6868

6969
function searchPrefix(x) {
70-
return x.search(/^(foo)?/); // NOT OK - `foo?` does not affect the returned index
70+
return x.search(/^(foo)?/) > -1; // NOT OK - `foo?` does not affect the returned index
7171
}
7272

7373
function searchSuffix(x) {
74-
return x.search(/(foo)?$/); // OK - `foo?` affects the returned index
74+
return x.search(/(foo)?$/) > -1; // OK - `foo?` affects the returned index
7575
}
7676

7777
function wordBoundary(x) {

0 commit comments

Comments
 (0)