mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
20 lines
366 B
V
20 lines
366 B
V
import regex
|
|
|
|
fn test_complex_matching() {
|
|
tmp_text := r"[export:'something']
|
|
const (
|
|
some_const = [1114111, 127, 2047, 65535, 1114111]!
|
|
|
|
)
|
|
|
|
[export:'something_empty']
|
|
const (
|
|
empty_const = ()
|
|
)
|
|
"
|
|
query := r'\[export:\S+\]\sconst\s\(\s+\S+\s{3}=\s\('
|
|
mut re := regex.regex_opt(query) or { panic(err) }
|
|
mut a := re.find_all(tmp_text)
|
|
assert a == [86, 138]
|
|
}
|