mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
JS: Fix and expand test cases
This commit is contained in:
@@ -3,7 +3,7 @@ function optionalPrefix(x) {
|
||||
}
|
||||
|
||||
function mandatoryPrefix(x) {
|
||||
return /^https:/.test(x); // NOT OK
|
||||
return /^https:/.test(x); // OK
|
||||
}
|
||||
|
||||
function httpOrHttps(x) {
|
||||
@@ -65,3 +65,11 @@ function search2(x) {
|
||||
function lookahead(x) {
|
||||
return /(?!x)/.search(x); // OK
|
||||
}
|
||||
|
||||
function searchPrefix(x) {
|
||||
return /^foo?/.search(x); // NOT OK - `foo?` does not affect the returned index
|
||||
}
|
||||
|
||||
function searchSuffix(x) {
|
||||
return /foo?$/.search(x); // OK - `foo?` affects the returned index
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user