github.com/oweisse/u-root@v0.0.0-20181109060735-d005ad25fef1/cmds/elvish/edit/completion/matcher_test.go (about) 1 package completion 2 3 import ( 4 "testing" 5 ) 6 7 func TestBuiltinMatcher(t *testing.T) { 8 tests := []filterRawCandidatesTest{ 9 { 10 name: "matchPrefix", 11 matcher: matchPrefix, 12 seed: "x", 13 src: []string{"x1", "x2", "3"}, 14 want: []string{"x1", "x2"}, 15 }, 16 { 17 name: "matchSubstr", 18 matcher: matchSubstr, 19 seed: "x", 20 src: []string{"1x", "2x", "3"}, 21 want: []string{"1x", "2x"}, 22 }, 23 { 24 name: "matchSubseq", 25 matcher: matchSubseq, 26 seed: "xyz", 27 src: []string{"1xyz1", "2abc2", "123"}, 28 want: []string{"1xyz1"}, 29 }, 30 } 31 32 testRawFilterCandidates(t, tests) 33 }