Skip to content

Commit 049027f

Browse files
committed
asserter methods deprecated
1 parent a1e64a4 commit 049027f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

assert/asserter.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ const (
4848
const officialTestOutputPrefix = " "
4949

5050
// NoImplementation always fails with no implementation.
51+
// Deprecated: use e.g. assert.NotImplemented(), only default asserter is used.
5152
func (asserter Asserter) NoImplementation(a ...any) {
5253
asserter.reportAssertionFault("not implemented", a...)
5354
}
5455

5556
// True asserts that term is true. If not it panics with the given formatting
5657
// string. Note! This and Truef are the most performant of all the assertion
5758
// functions.
59+
// Deprecated: use e.g. assert.That(), only default asserter is used.
5860
func (asserter Asserter) True(term bool, a ...any) {
5961
if !term {
6062
asserter.reportAssertionFault("assertion fault", a...)
@@ -63,6 +65,7 @@ func (asserter Asserter) True(term bool, a ...any) {
6365

6466
// Truef asserts that term is true. If not it panics with the given formatting
6567
// string.
68+
// Deprecated: use e.g. assert.That(), only default asserter is used.
6669
func (asserter Asserter) Truef(term bool, format string, a ...any) {
6770
if !term {
6871
if asserter.hasStackTrace() {
@@ -76,6 +79,7 @@ func (asserter Asserter) Truef(term bool, format string, a ...any) {
7679
// panics/errors (current Asserter) with the given msg. Note! This is very slow
7780
// (before we have generics). If you need performance use EqualInt. It's not so
7881
// convenient, though.
82+
// Deprecated: use e.g. assert.Len(), only default asserter is used.
7983
func (asserter Asserter) Len(obj any, length int, a ...any) {
8084
ok, l := getLen(obj)
8185
if !ok {
@@ -90,6 +94,7 @@ func (asserter Asserter) Len(obj any, length int, a ...any) {
9094

9195
// EqualInt asserts that integers are equal. If not it panics/errors (current
9296
// Asserter) with the given msg.
97+
// Deprecated: use e.g. assert.Equal(), only default asserter is used.
9398
func (asserter Asserter) EqualInt(val, want int, a ...any) {
9499
if want != val {
95100
defMsg := fmt.Sprintf("got %d, want %d", val, want)
@@ -101,13 +106,15 @@ func (asserter Asserter) EqualInt(val, want int, a ...any) {
101106
// panics/errors (current Asserter) with the given msg. Note! This is very slow
102107
// (before we have generics). If you need performance use EqualInt. It's not so
103108
// convenient, though.
109+
// Deprecated: use e.g. assert.Len(), only default asserter is used.
104110
func (asserter Asserter) Lenf(obj any, length int, format string, a ...any) {
105111
args := combineArgs(format, a)
106112
asserter.Len(obj, length, args...)
107113
}
108114

109115
// Empty asserts that length of the object is zero. If not it panics with the
110116
// given formatting string. Note! This is slow.
117+
// Deprecated: use e.g. assert.Empty(), only default asserter is used.
111118
func (asserter Asserter) Empty(obj any, msg ...any) {
112119
ok, l := getLen(obj)
113120
if !ok {
@@ -122,13 +129,15 @@ func (asserter Asserter) Empty(obj any, msg ...any) {
122129

123130
// NotEmptyf asserts that length of the object greater than zero. If not it
124131
// panics with the given formatting string. Note! This is slow.
132+
// Deprecated: use e.g. assert.NotEmpty(), only default asserter is used.
125133
func (asserter Asserter) NotEmptyf(obj any, format string, msg ...any) {
126134
args := combineArgs(format, msg)
127135
asserter.Empty(obj, args...)
128136
}
129137

130138
// NotEmpty asserts that length of the object greater than zero. If not it
131139
// panics with the given formatting string. Note! This is slow.
140+
// Deprecated: use e.g. assert.NotEmpty(), only default asserter is used.
132141
func (asserter Asserter) NotEmpty(obj any, msg ...any) {
133142
ok, l := getLen(obj)
134143
if !ok {

0 commit comments

Comments
 (0)