diff options
| author | Eyal Posener <[email protected]> | 2017-11-04 11:52:49 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-11-04 11:52:49 +0200 |
| commit | a1f9ea005b8360153429321071da4e42ce6ce323 (patch) | |
| tree | 0f7976f712f3cb3c70eac8eb78b5027e445e16c8 /gocomplete | |
| parent | aae7e1e39fb3554591e2d20b4c86fea9bf2b15bc (diff) | |
| parent | 00c86494ff7035cfd62f66042e9ca2b118b90122 (diff) | |
Merge branch 'master' into split-last-equal
Diffstat (limited to 'gocomplete')
| -rw-r--r-- | gocomplete/tests.go | 11 | ||||
| -rw-r--r-- | gocomplete/tests_test.go | 27 |
2 files changed, 2 insertions, 36 deletions
diff --git a/gocomplete/tests.go b/gocomplete/tests.go index a952dab..e755ae5 100644 --- a/gocomplete/tests.go +++ b/gocomplete/tests.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/posener/complete" - "github.com/posener/complete/match" ) var ( @@ -21,14 +20,8 @@ var ( // for test names use prefix of 'Test' or 'Example', and for benchmark // test names use 'Benchmark' func funcPredict(funcRegexp *regexp.Regexp) complete.Predictor { - return complete.PredictFunc(func(a complete.Args) (prediction []string) { - tests := funcNames(funcRegexp) - for _, t := range tests { - if match.Prefix(t, a.Last) { - prediction = append(prediction, t) - } - } - return + return complete.PredictFunc(func(a complete.Args) []string { + return funcNames(funcRegexp) }) } diff --git a/gocomplete/tests_test.go b/gocomplete/tests_test.go index 6799157..150e2e2 100644 --- a/gocomplete/tests_test.go +++ b/gocomplete/tests_test.go @@ -23,37 +23,10 @@ func TestPredictions(t *testing.T) { want: []string{"TestPredictions", "Example"}, }, { - name: "predict tests not found", - predictor: predictTest, - last: "X", - }, - { name: "predict benchmark ok", predictor: predictBenchmark, want: []string{"BenchmarkFake"}, }, - { - name: "predict benchmarks not found", - predictor: predictBenchmark, - last: "X", - }, - { - name: "predict local ok", - predictor: complete.PredictFunc(predictPackages), - last: ".", - want: []string{"./"}, - }, - { - name: "predict system ok", - predictor: complete.PredictFunc(predictPackages), - last: "github.com/posener/complete/goc", - want: []string{"github.com/posener/complete/gocomplete/"}, - }, - { - name: "predict packages not found", - predictor: complete.PredictFunc(predictPackages), - last: "X", - }, } for _, tt := range tests { |
