JS: Update test for RegExpAlwaysMatches

This commit is contained in:
Asger F
2023-05-26 14:10:26 +02:00
parent 9df9ca2916
commit c637b6f59a

View File

@@ -55,23 +55,23 @@ function emptyAlt3(x) {
} }
function search(x) { function search(x) {
return x.search(/[a-z]*/); // NOT OK return x.search(/[a-z]*/) > -1; // NOT OK
} }
function search2(x) { function search2(x) {
return x.search(/[a-z]/); // OK return x.search(/[a-z]/) > -1; // OK
} }
function lookahead(x) { function lookahead(x) {
return x.search(/(?!x)/); // OK return x.search(/(?!x)/) > -1; // OK
} }
function searchPrefix(x) { function searchPrefix(x) {
return x.search(/^(foo)?/); // NOT OK - `foo?` does not affect the returned index return x.search(/^(foo)?/) > -1; // NOT OK - `foo?` does not affect the returned index
} }
function searchSuffix(x) { function searchSuffix(x) {
return x.search(/(foo)?$/); // OK - `foo?` affects the returned index return x.search(/(foo)?$/) > -1; // OK - `foo?` affects the returned index
} }
function wordBoundary(x) { function wordBoundary(x) {