-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate empty test using /gen-test ChatOpts command #2005
Changes from all commits
bca8d18
67e11ad
dfc5f92
79f9fea
baf038d
11b167d
b34a25d
b5de475
349d55d
a48e0d9
33912bf
3294724
bed1095
339cea4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,81 @@ | |
|
||
// Package main provides program main | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/vdaas/vald/internal/test/goleak" | ||
) | ||
|
||
// NOT IMPLEMENTED BELOW | ||
|
||
func Test_main(t *testing.T) { | ||
type want struct{} | ||
type test struct { | ||
name string | ||
want want | ||
checkFunc func(want) error | ||
beforeFunc func(*testing.T) | ||
afterFunc func(*testing.T) | ||
} | ||
defaultCheckFunc := func(w want) error { | ||
return nil | ||
} | ||
tests := []test{ | ||
// TODO test cases | ||
/* | ||
{ | ||
name: "test_case_1", | ||
want: want{}, | ||
checkFunc: defaultCheckFunc, | ||
beforeFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
afterFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
}, | ||
*/ | ||
|
||
// TODO test cases | ||
/* | ||
func() test { | ||
return test { | ||
name: "test_case_2", | ||
want: want{}, | ||
checkFunc: defaultCheckFunc, | ||
beforeFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
afterFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
} | ||
}(), | ||
*/ | ||
} | ||
|
||
for _, tc := range tests { | ||
test := tc | ||
t.Run(test.name, func(tt *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci] reported by reviewdog 🐶 |
||
tt.Parallel() | ||
defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) | ||
if test.beforeFunc != nil { | ||
test.beforeFunc(tt) | ||
} | ||
if test.afterFunc != nil { | ||
defer test.afterFunc(tt) | ||
} | ||
checkFunc := test.checkFunc | ||
if test.checkFunc == nil { | ||
checkFunc = defaultCheckFunc | ||
} | ||
|
||
main() | ||
if err := checkFunc(test.want); err != nil { | ||
tt.Errorf("error = %v", err) | ||
} | ||
}) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,81 @@ | |
|
||
// Package main provides program main | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/vdaas/vald/internal/test/goleak" | ||
) | ||
|
||
// NOT IMPLEMENTED BELOW | ||
|
||
func Test_main(t *testing.T) { | ||
type want struct{} | ||
type test struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci] reported by reviewdog 🐶 |
||
name string | ||
want want | ||
checkFunc func(want) error | ||
beforeFunc func(*testing.T) | ||
afterFunc func(*testing.T) | ||
} | ||
defaultCheckFunc := func(w want) error { | ||
return nil | ||
} | ||
tests := []test{ | ||
// TODO test cases | ||
/* | ||
{ | ||
name: "test_case_1", | ||
want: want{}, | ||
checkFunc: defaultCheckFunc, | ||
beforeFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
afterFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
}, | ||
*/ | ||
|
||
// TODO test cases | ||
/* | ||
func() test { | ||
return test { | ||
name: "test_case_2", | ||
want: want{}, | ||
checkFunc: defaultCheckFunc, | ||
beforeFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
afterFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
} | ||
}(), | ||
*/ | ||
} | ||
|
||
for _, tc := range tests { | ||
test := tc | ||
t.Run(test.name, func(tt *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci] reported by reviewdog 🐶 |
||
tt.Parallel() | ||
defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) | ||
if test.beforeFunc != nil { | ||
test.beforeFunc(tt) | ||
} | ||
if test.afterFunc != nil { | ||
defer test.afterFunc(tt) | ||
} | ||
checkFunc := test.checkFunc | ||
if test.checkFunc == nil { | ||
checkFunc = defaultCheckFunc | ||
} | ||
|
||
main() | ||
if err := checkFunc(test.want); err != nil { | ||
tt.Errorf("error = %v", err) | ||
} | ||
}) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,81 @@ | |
|
||
// Package main provides program main | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/vdaas/vald/internal/test/goleak" | ||
) | ||
|
||
// NOT IMPLEMENTED BELOW | ||
|
||
func Test_main(t *testing.T) { | ||
type want struct{} | ||
type test struct { | ||
name string | ||
want want | ||
checkFunc func(want) error | ||
beforeFunc func(*testing.T) | ||
afterFunc func(*testing.T) | ||
} | ||
defaultCheckFunc := func(w want) error { | ||
return nil | ||
} | ||
tests := []test{ | ||
// TODO test cases | ||
/* | ||
{ | ||
name: "test_case_1", | ||
want: want{}, | ||
checkFunc: defaultCheckFunc, | ||
beforeFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
afterFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
}, | ||
*/ | ||
|
||
// TODO test cases | ||
/* | ||
func() test { | ||
return test { | ||
name: "test_case_2", | ||
want: want{}, | ||
checkFunc: defaultCheckFunc, | ||
beforeFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
afterFunc: func(t *testing.T,) { | ||
t.Helper() | ||
}, | ||
} | ||
}(), | ||
*/ | ||
} | ||
|
||
for _, tc := range tests { | ||
test := tc | ||
t.Run(test.name, func(tt *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci] reported by reviewdog 🐶 |
||
tt.Parallel() | ||
defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) | ||
if test.beforeFunc != nil { | ||
test.beforeFunc(tt) | ||
} | ||
if test.afterFunc != nil { | ||
defer test.afterFunc(tt) | ||
} | ||
checkFunc := test.checkFunc | ||
if test.checkFunc == nil { | ||
checkFunc = defaultCheckFunc | ||
} | ||
|
||
main() | ||
if err := checkFunc(test.want); err != nil { | ||
tt.Errorf("error = %v", err) | ||
} | ||
}) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
fieldalignment: struct with 40 pointer bytes could be 32 (govet)