1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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