Skip to content

Commit

Permalink
change error message format
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
  • Loading branch information
kpango committed Sep 7, 2020
1 parent d23ea5a commit 39b09d3
Show file tree
Hide file tree
Showing 365 changed files with 3,432 additions and 3,410 deletions.
4 changes: 2 additions & 2 deletions assets/test/templates/common/function.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ func {{ .TestName }}(t *testing.T) {

{{- if .ReturnsError }}
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
{{- end }}
{{- range .TestResults }} {{ $want := Want . }} {{ $got := Got . }}
if !reflect.DeepEqual({{ $got }}, w.{{ $want }}) {
return errors.Errorf("got = %v, want %v", {{ $got }}, w.{{ $want }})
return errors.Errorf("got: \"%v\",\twant: \"%v\"", {{ $got }}, w.{{ $want }})
}
{{- end }}
return nil
Expand Down
6 changes: 3 additions & 3 deletions assets/test/templates/option/function.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ func {{ .TestName }}(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -65,7 +65,7 @@ func {{ .TestName }}(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark/core/benchmark/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestNew(t *testing.T) {
}
defaultCheckFunc := func(w want, got Benchmark) error {
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down
12 changes: 6 additions & 6 deletions hack/benchmark/core/benchmark/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ func TestWithName(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -61,7 +61,7 @@ func TestWithName(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -161,10 +161,10 @@ func TestWithStrategy(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -174,7 +174,7 @@ func TestWithStrategy(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestNewBulkInsertCommit(t *testing.T) {
}
defaultCheckFunc := func(w want, got benchmark.Strategy) error {
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark/core/benchmark/strategy/bulk_insert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestNewBulkInsert(t *testing.T) {
}
defaultCheckFunc := func(w want, got benchmark.Strategy) error {
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark/core/benchmark/strategy/get_vector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestNewGetVector(t *testing.T) {
}
defaultCheckFunc := func(w want, got benchmark.Strategy) error {
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestNewInsertCommit(t *testing.T) {
}
defaultCheckFunc := func(w want, got benchmark.Strategy) error {
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark/core/benchmark/strategy/insert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestNewInsert(t *testing.T) {
}
defaultCheckFunc := func(w want, got benchmark.Strategy) error {
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark/core/benchmark/strategy/remove_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestNewRemove(t *testing.T) {
}
defaultCheckFunc := func(w want, got benchmark.Strategy) error {
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark/core/benchmark/strategy/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestNewSearch(t *testing.T) {
}
defaultCheckFunc := func(w want, got benchmark.Strategy) error {
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down
48 changes: 24 additions & 24 deletions hack/benchmark/core/benchmark/strategy/strategy_option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ func TestWithPreProp32(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -65,7 +65,7 @@ func TestWithPreProp32(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -165,10 +165,10 @@ func TestWithProp32(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -178,7 +178,7 @@ func TestWithProp32(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -278,10 +278,10 @@ func TestWithPreProp64(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -291,7 +291,7 @@ func TestWithPreProp64(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -391,10 +391,10 @@ func TestWithProp64(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -404,7 +404,7 @@ func TestWithProp64(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -504,10 +504,10 @@ func TestWithPropName(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -517,7 +517,7 @@ func TestWithPropName(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -617,10 +617,10 @@ func TestWithCore32(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -630,7 +630,7 @@ func TestWithCore32(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -730,10 +730,10 @@ func TestWithCore64(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -743,7 +743,7 @@ func TestWithCore64(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -839,10 +839,10 @@ func TestWithParallel(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.obj)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.obj)
}
return nil
}
Expand All @@ -852,7 +852,7 @@ func TestWithParallel(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return errors.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", obj, w.c)
}
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions hack/benchmark/core/benchmark/strategy/strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func Test_newStrategy(t *testing.T) {
}
defaultCheckFunc := func(w want, got benchmark.Strategy) error {
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func Test_strategy_Init(t *testing.T) {
}
defaultCheckFunc := func(w want, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
return nil
}
Expand Down Expand Up @@ -270,10 +270,10 @@ func Test_strategy_PreProp(t *testing.T) {
}
defaultCheckFunc := func(w want, got []uint, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(got, w.want) {
return errors.Errorf("got = %v, want %v", got, w.want)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", got, w.want)
}
return nil
}
Expand Down
10 changes: 5 additions & 5 deletions hack/benchmark/core/benchmark/strategy/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Test_wrapErrors(t *testing.T) {
}
defaultCheckFunc := func(w want, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
return nil
}
Expand Down Expand Up @@ -120,10 +120,10 @@ func Test_insertAndCreateIndex32(t *testing.T) {
}
defaultCheckFunc := func(w want, gotIds []uint, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(gotIds, w.wantIds) {
return errors.Errorf("got = %v, want %v", gotIds, w.wantIds)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", gotIds, w.wantIds)
}
return nil
}
Expand Down Expand Up @@ -201,10 +201,10 @@ func Test_insertAndCreateIndex64(t *testing.T) {
}
defaultCheckFunc := func(w want, gotIds []uint, err error) error {
if !errors.Is(err, w.err) {
return errors.Errorf("got error = %v, want %v", err, w.err)
return errors.Errorf("got_error: \"%v\",\twant: \"%v\"", err, w.err)
}
if !reflect.DeepEqual(gotIds, w.wantIds) {
return errors.Errorf("got = %v, want %v", gotIds, w.wantIds)
return errors.Errorf("got: \"%v\",\twant: \"%v\"", gotIds, w.wantIds)
}
return nil
}
Expand Down
Loading

0 comments on commit 39b09d3

Please sign in to comment.