diff options
Diffstat (limited to 'gocomplete/tests_test.go')
| -rw-r--r-- | gocomplete/tests_test.go | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/gocomplete/tests_test.go b/gocomplete/tests_test.go index 5683d24..6799157 100644 --- a/gocomplete/tests_test.go +++ b/gocomplete/tests_test.go @@ -12,15 +12,15 @@ func TestPredictions(t *testing.T) { t.Parallel() tests := []struct { - name string - predictor complete.Predictor - last string - completion []string + name string + predictor complete.Predictor + last string + want []string }{ { - name: "predict tests ok", - predictor: predictTest, - completion: []string{"TestPredictions", "Example"}, + name: "predict tests ok", + predictor: predictTest, + want: []string{"TestPredictions", "Example"}, }, { name: "predict tests not found", @@ -28,9 +28,9 @@ func TestPredictions(t *testing.T) { last: "X", }, { - name: "predict benchmark ok", - predictor: predictBenchmark, - completion: []string{"BenchmarkFake"}, + name: "predict benchmark ok", + predictor: predictBenchmark, + want: []string{"BenchmarkFake"}, }, { name: "predict benchmarks not found", @@ -38,9 +38,16 @@ func TestPredictions(t *testing.T) { last: "X", }, { - name: "predict packages ok", - predictor: complete.PredictFunc(predictPackages), - completion: []string{"./"}, + 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", @@ -53,8 +60,8 @@ func TestPredictions(t *testing.T) { t.Run(tt.name, func(t *testing.T) { a := complete.Args{Last: tt.last} got := tt.predictor.Predict(a) - if want := tt.completion; !equal(got, want) { - t.Errorf("Failed %s: completion = %q, want %q", t.Name(), got, want) + if !equal(got, tt.want) { + t.Errorf("Failed %s: got: %q, want: %q", t.Name(), got, tt.want) } }) } |
