mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
13 lines
531 B
V
13 lines
531 B
V
import v.token
|
|
|
|
fn test_new_keywords_matcher_from_array_trie_works() {
|
|
method_names := ['filter', 'clone', 'repeat', 'reverse', 'map', 'slice', 'sort', 'contains',
|
|
'index', 'wait', 'any', 'all', 'first', 'last', 'pop_left', 'pop']
|
|
matcher := token.new_keywords_matcher_from_array_trie(method_names)
|
|
for word in [method_names.first(), method_names.last(), 'something', 'another', 'x', 'y', '',
|
|
'---', '123', 'abc.def', 'xyz !@#'] {
|
|
res1 := matcher.find(word) != -1
|
|
res2 := word in method_names
|
|
assert res1 == res2
|
|
}
|
|
}
|