JS: Fix and expand test cases

This commit is contained in:
Asger Feldthaus
2020-01-06 14:43:29 +00:00
parent 9928762769
commit 4c25d84b6e

View File

@@ -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
}