Skip to content

Commit a11649e

Browse files
committed
assert: make *AssertionFunc type just aliases
We don't need to define "hard" types for *AssertionFunc types as we don't attach methods to them. Also, making them just type aliases will give more flexibility to users of our API. So ComparisonAssertionFunc and other *AssertionFunc types are now just type aliases.
1 parent dc20f41 commit a11649e

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

assert/assertions.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ type TestingT interface {
3232

3333
// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful
3434
// for table driven tests.
35-
type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool
35+
type ComparisonAssertionFunc = func(TestingT, interface{}, interface{}, ...interface{}) bool
3636

3737
// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful
3838
// for table driven tests.
39-
type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool
39+
type ValueAssertionFunc = func(TestingT, interface{}, ...interface{}) bool
4040

4141
// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful
4242
// for table driven tests.
43-
type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool
43+
type BoolAssertionFunc = func(TestingT, bool, ...interface{}) bool
4444

4545
// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful
4646
// for table driven tests.
47-
type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool
47+
type ErrorAssertionFunc = func(TestingT, error, ...interface{}) bool
4848

4949
// PanicAssertionFunc is a common function prototype when validating a panic value. Can be useful
5050
// for table driven tests.

require/requirements.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ type tHelper = interface {
1212

1313
// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful
1414
// for table driven tests.
15-
type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{})
15+
type ComparisonAssertionFunc = func(TestingT, interface{}, interface{}, ...interface{})
1616

1717
// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful
1818
// for table driven tests.
19-
type ValueAssertionFunc func(TestingT, interface{}, ...interface{})
19+
type ValueAssertionFunc = func(TestingT, interface{}, ...interface{})
2020

2121
// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful
2222
// for table driven tests.
23-
type BoolAssertionFunc func(TestingT, bool, ...interface{})
23+
type BoolAssertionFunc = func(TestingT, bool, ...interface{})
2424

2525
// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful
2626
// for table driven tests.
27-
type ErrorAssertionFunc func(TestingT, error, ...interface{})
27+
type ErrorAssertionFunc = func(TestingT, error, ...interface{})
2828

2929
//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require.go.tmpl -include-format-funcs"

0 commit comments

Comments
 (0)