regex: remove [deprecated] functions/methods, code clean, add test for regex_base (#8862)

This commit is contained in:
penguindark 2021-02-20 20:39:08 +01:00 committed by GitHub
parent 8f486cb8cf
commit cc565b22a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 42 deletions

View file

@ -479,7 +479,21 @@ fn test_regex(){
}
}
if debug { println("DONE!") }
if debug { println("DONE!") }
}
// test regex_base function
fn test_regex_func(){
query := r"\d\dabcd"
test_str := "78abcd"
mut re, re_err, err_pos := regex.regex_base(query)
if re_err == regex.compile_ok {
start, end := re.match_string(test_str)
assert (start == 0) && (end == 6)
} else {
eprintln("Error in query string in pos ${err_pos}")
eprintln("Error: ${re.get_parse_error_string(re_err)}")
assert false
}
}