mirror of
https://github.com/vlang/v.git
synced 2025-09-14 06:52:36 +03:00
regex: remove [deprecated] functions/methods, code clean, add test for regex_base (#8862)
This commit is contained in:
parent
8f486cb8cf
commit
cc565b22a9
3 changed files with 48 additions and 42 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue