Skip to content

Commit 2b939bb

Browse files
committed
rm deprecated assert functions
1 parent 377a891 commit 2b939bb

File tree

1 file changed

+0
-103
lines changed

1 file changed

+0
-103
lines changed

assert/asserter.go

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -47,109 +47,6 @@ const (
4747
// every test log or result output has 4 spaces in them
4848
const officialTestOutputPrefix = " "
4949

50-
// NoImplementation always fails with no implementation.
51-
// Deprecated: use e.g. assert.NotImplemented(), only default asserter is used.
52-
func (asserter Asserter) NoImplementation(a ...any) {
53-
asserter.reportAssertionFault("not implemented", a...)
54-
}
55-
56-
// True asserts that term is true. If not it panics with the given formatting
57-
// string. Note! This and Truef are the most performant of all the assertion
58-
// functions.
59-
// Deprecated: use e.g. assert.That(), only default asserter is used.
60-
func (asserter Asserter) True(term bool, a ...any) {
61-
if !term {
62-
asserter.reportAssertionFault("assertion fault", a...)
63-
}
64-
}
65-
66-
// Truef asserts that term is true. If not it panics with the given formatting
67-
// string.
68-
// Deprecated: use e.g. assert.That(), only default asserter is used.
69-
func (asserter Asserter) Truef(term bool, format string, a ...any) {
70-
if !term {
71-
if asserter.hasStackTrace() {
72-
debug.PrintStack(1)
73-
}
74-
asserter.reportPanic(fmt.Sprintf(format, a...))
75-
}
76-
}
77-
78-
// Len asserts that length of the object is equal to given. If not it
79-
// panics/errors (current Asserter) with the given msg. Note! This is very slow
80-
// (before we have generics). If you need performance use EqualInt. It's not so
81-
// convenient, though.
82-
// Deprecated: use e.g. assert.Len(), only default asserter is used.
83-
func (asserter Asserter) Len(obj any, length int, a ...any) {
84-
ok, l := getLen(obj)
85-
if !ok {
86-
panic("cannot get length")
87-
}
88-
89-
if l != length {
90-
defMsg := fmt.Sprintf("got %d, want %d", l, length)
91-
asserter.reportAssertionFault(defMsg, a...)
92-
}
93-
}
94-
95-
// EqualInt asserts that integers are equal. If not it panics/errors (current
96-
// Asserter) with the given msg.
97-
// Deprecated: use e.g. assert.Equal(), only default asserter is used.
98-
func (asserter Asserter) EqualInt(val, want int, a ...any) {
99-
if want != val {
100-
defMsg := fmt.Sprintf("got %d, want %d", val, want)
101-
asserter.reportAssertionFault(defMsg, a...)
102-
}
103-
}
104-
105-
// Lenf asserts that length of the object is equal to given. If not it
106-
// panics/errors (current Asserter) with the given msg. Note! This is very slow
107-
// (before we have generics). If you need performance use EqualInt. It's not so
108-
// convenient, though.
109-
// Deprecated: use e.g. assert.Len(), only default asserter is used.
110-
func (asserter Asserter) Lenf(obj any, length int, format string, a ...any) {
111-
args := combineArgs(format, a)
112-
asserter.Len(obj, length, args...)
113-
}
114-
115-
// Empty asserts that length of the object is zero. If not it panics with the
116-
// given formatting string. Note! This is slow.
117-
// Deprecated: use e.g. assert.Empty(), only default asserter is used.
118-
func (asserter Asserter) Empty(obj any, msg ...any) {
119-
ok, l := getLen(obj)
120-
if !ok {
121-
panic("cannot get length")
122-
}
123-
124-
if l != 0 {
125-
defMsg := fmt.Sprintf("got %d, want == 0", l)
126-
asserter.reportAssertionFault(defMsg, msg...)
127-
}
128-
}
129-
130-
// NotEmptyf asserts that length of the object greater than zero. If not it
131-
// panics with the given formatting string. Note! This is slow.
132-
// Deprecated: use e.g. assert.NotEmpty(), only default asserter is used.
133-
func (asserter Asserter) NotEmptyf(obj any, format string, msg ...any) {
134-
args := combineArgs(format, msg)
135-
asserter.Empty(obj, args...)
136-
}
137-
138-
// NotEmpty asserts that length of the object greater than zero. If not it
139-
// panics with the given formatting string. Note! This is slow.
140-
// Deprecated: use e.g. assert.NotEmpty(), only default asserter is used.
141-
func (asserter Asserter) NotEmpty(obj any, msg ...any) {
142-
ok, l := getLen(obj)
143-
if !ok {
144-
panic("cannot get length")
145-
}
146-
147-
if l == 0 {
148-
defMsg := fmt.Sprintf("got %d, want > 0", l)
149-
asserter.reportAssertionFault(defMsg, msg...)
150-
}
151-
}
152-
15350
func (asserter Asserter) reportAssertionFault(defaultMsg string, a ...any) {
15451
if asserter.hasStackTrace() {
15552
if asserter.isUnitTesting() {

0 commit comments

Comments
 (0)