| 1 | import v.token |
| 2 | |
| 3 | fn test_new_keywords_matcher_from_array_trie_works() { |
| 4 | method_names := ['filter', 'clone', 'repeat', 'reverse', 'map', 'slice', 'sort', 'contains', |
| 5 | 'index', 'last_index', 'wait', 'any', 'all', 'first', 'last', 'pop_left', 'pop'] |
| 6 | matcher := token.new_keywords_matcher_from_array_trie(method_names) |
| 7 | for word in [method_names.first(), method_names.last(), 'something', 'another', 'x', 'y', '', |
| 8 | '---', '123', 'abc.def', 'xyz !@#'] { |
| 9 | res1 := matcher.find(word) != -1 |
| 10 | res2 := word in method_names |
| 11 | assert res1 == res2 |
| 12 | } |
| 13 | } |
| 14 | |