|
1 | 1 | # A simple assertion library using Go generics |
2 | 2 |
|
3 | | -[](https://pkg.go.dev/github.com/alecthomas/assert/v2) [](https://github.com/alecthomas/assert/actions/workflows/ci.yml) |
| 3 | +[](https://pkg.go.dev/github.com/alecthomas/assert/v2) [](https://github.com/alecthomas/assert/actions/workflows/ci.yml) |
4 | 4 | [](https://goreportcard.com/report/github.com/alecthomas/assert/v2) [](https://gophers.slack.com/messages/CN9DS8YF3) |
5 | 5 |
|
6 | 6 |
|
@@ -35,55 +35,55 @@ format error messages using the `fmt` package. |
35 | 35 | // Equal asserts that "expected" and "actual" are equal using google/go-cmp. |
36 | 36 | // |
37 | 37 | // If they are not, a diff of the Go representation of the values will be displayed. |
38 | | -func Equal[T comparable](t testing.TB, expected, actual T, msgAndArgs ...interface{}) |
| 38 | +func Equal[T comparable](t testing.TB, expected, actual T, msgAndArgs ...any) |
39 | 39 |
|
40 | 40 | // NotEqual asserts that "expected" is not equal to "actual" using google/go-cmp. |
41 | 41 | // |
42 | 42 | // If they are equal the expected value will be displayed. |
43 | | -func NotEqual[T comparable](t testing.TB, expected, actual T, msgAndArgs ...interface{}) |
| 43 | +func NotEqual[T comparable](t testing.TB, expected, actual T, msgAndArgs ...any) |
44 | 44 |
|
45 | 45 | // Zero asserts that a value is its zero value. |
46 | | -func Zero[T comparable](t testing.TB, value T, msgAndArgs ...interface{}) |
| 46 | +func Zero[T comparable](t testing.TB, value T, msgAndArgs ...any) |
47 | 47 |
|
48 | 48 | // NotZero asserts that a value is not its zero value. |
49 | | -func NotZero[T comparable](t testing.TB, value T, msgAndArgs ...interface{}) |
| 49 | +func NotZero[T comparable](t testing.TB, value T, msgAndArgs ...any) |
50 | 50 |
|
51 | 51 | // Contains asserts that "haystack" contains "needle". |
52 | | -func Contains(t testing.TB, haystack string, needle string, msgAndArgs ...interface{}) |
| 52 | +func Contains(t testing.TB, haystack string, needle string, msgAndArgs ...any) |
53 | 53 |
|
54 | 54 | // NotContains asserts that "haystack" does not contain "needle". |
55 | | -func NotContains(t testing.TB, haystack string, needle string, msgAndArgs ...interface{}) |
| 55 | +func NotContains(t testing.TB, haystack string, needle string, msgAndArgs ...any) |
56 | 56 |
|
57 | 57 | // EqualError asserts that either an error is non-nil and that its message is what is expected, |
58 | 58 | // or that error is nil if the expected message is empty. |
59 | | -func EqualError(t testing.TB, err error, errString string, msgAndArgs...interface{}) |
| 59 | +func EqualError(t testing.TB, err error, errString string, msgAndArgs ...any) |
60 | 60 |
|
61 | 61 | // Error asserts that an error is not nil. |
62 | | -func Error(t testing.TB, err error, msgAndArgs ...interface{}) |
| 62 | +func Error(t testing.TB, err error, msgAndArgs ...any) |
63 | 63 |
|
64 | 64 | // NoError asserts that an error is nil. |
65 | | -func NoError(t testing.TB, err error, msgAndArgs ...interface{}) |
| 65 | +func NoError(t testing.TB, err error, msgAndArgs ...any) |
66 | 66 |
|
67 | 67 | // IsError asserts than any error in "err"'s tree matches "target". |
68 | | -func IsError(t testing.TB, err, target error, msgAndArgs ...interface{}) |
| 68 | +func IsError(t testing.TB, err, target error, msgAndArgs ...any) |
69 | 69 |
|
70 | 70 | // NotIsError asserts than no error in "err"'s tree matches "target". |
71 | | -func NotIsError(t testing.TB, err, target error, msgAndArgs ...interface{}) |
| 71 | +func NotIsError(t testing.TB, err, target error, msgAndArgs ...any) |
72 | 72 |
|
73 | 73 | // Panics asserts that the given function panics. |
74 | | -func Panics(t testing.TB, fn func(), msgAndArgs ...interface{}) |
| 74 | +func Panics(t testing.TB, fn func(), msgAndArgs ...any) |
75 | 75 |
|
76 | 76 | // NotPanics asserts that the given function does not panic. |
77 | | -func NotPanics(t testing.TB, fn func(), msgAndArgs ...interface{}) |
| 77 | +func NotPanics(t testing.TB, fn func(), msgAndArgs ...any) |
78 | 78 |
|
79 | 79 | // Compare two values for equality and return true or false. |
80 | 80 | func Compare[T any](t testing.TB, x, y T) bool |
81 | 81 |
|
82 | 82 | // True asserts that an expression is true. |
83 | | -func True(t testing.TB, ok bool, msgAndArgs ...interface{}) |
| 83 | +func True(t testing.TB, ok bool, msgAndArgs ...any) |
84 | 84 |
|
85 | 85 | // False asserts that an expression is false. |
86 | | -func False(t testing.TB, ok bool, msgAndArgs ...interface{}) |
| 86 | +func False(t testing.TB, ok bool, msgAndArgs ...any) |
87 | 87 | ``` |
88 | 88 |
|
89 | 89 | ## Evaluation process |
|
0 commit comments