v/vlib/v/token/keywords_matcher_trie_test.v
2025-08-19 14:37:18 +03:00

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