9
9
10
10
// ShouldContain receives exactly two parameters. The first is a slice and the
11
11
// second is a proposed member. Membership is determined using ShouldEqual.
12
- func ShouldContain (actual interface {} , expected ... interface {} ) string {
12
+ func ShouldContain (actual any , expected ... any ) string {
13
13
if fail := need (1 , expected ); fail != success {
14
14
return fail
15
15
}
@@ -27,7 +27,7 @@ func ShouldContain(actual interface{}, expected ...interface{}) string {
27
27
28
28
// ShouldNotContain receives exactly two parameters. The first is a slice and the
29
29
// second is a proposed member. Membership is determined using ShouldEqual.
30
- func ShouldNotContain (actual interface {} , expected ... interface {} ) string {
30
+ func ShouldNotContain (actual any , expected ... any ) string {
31
31
if fail := need (1 , expected ); fail != success {
32
32
return fail
33
33
}
@@ -44,7 +44,7 @@ func ShouldNotContain(actual interface{}, expected ...interface{}) string {
44
44
45
45
// ShouldContainKey receives exactly two parameters. The first is a map and the
46
46
// second is a proposed key. Keys are compared with a simple '=='.
47
- func ShouldContainKey (actual interface {} , expected ... interface {} ) string {
47
+ func ShouldContainKey (actual any , expected ... any ) string {
48
48
if fail := need (1 , expected ); fail != success {
49
49
return fail
50
50
}
@@ -63,7 +63,7 @@ func ShouldContainKey(actual interface{}, expected ...interface{}) string {
63
63
64
64
// ShouldNotContainKey receives exactly two parameters. The first is a map and the
65
65
// second is a proposed absent key. Keys are compared with a simple '=='.
66
- func ShouldNotContainKey (actual interface {} , expected ... interface {} ) string {
66
+ func ShouldNotContainKey (actual any , expected ... any ) string {
67
67
if fail := need (1 , expected ); fail != success {
68
68
return fail
69
69
}
@@ -80,14 +80,14 @@ func ShouldNotContainKey(actual interface{}, expected ...interface{}) string {
80
80
return ""
81
81
}
82
82
83
- func mapKeys (m interface {} ) ([]reflect.Value , bool ) {
83
+ func mapKeys (m any ) ([]reflect.Value , bool ) {
84
84
value := reflect .ValueOf (m )
85
85
if value .Kind () != reflect .Map {
86
86
return nil , false
87
87
}
88
88
return value .MapKeys (), true
89
89
}
90
- func keyFound (keys []reflect.Value , expectedKey interface {} ) bool {
90
+ func keyFound (keys []reflect.Value , expectedKey any ) bool {
91
91
found := false
92
92
for _ , key := range keys {
93
93
if key .Interface () == expectedKey {
@@ -101,7 +101,7 @@ func keyFound(keys []reflect.Value, expectedKey interface{}) bool {
101
101
// that is passed in either as the second parameter, or of the collection that consists
102
102
// of all the remaining parameters. This assertion ensures that the proposed member is in
103
103
// the collection (using ShouldEqual).
104
- func ShouldBeIn (actual interface {} , expected ... interface {} ) string {
104
+ func ShouldBeIn (actual any , expected ... any ) string {
105
105
if fail := atLeast (1 , expected ); fail != success {
106
106
return fail
107
107
}
@@ -111,7 +111,7 @@ func ShouldBeIn(actual interface{}, expected ...interface{}) string {
111
111
}
112
112
return shouldBeIn (actual , expected )
113
113
}
114
- func shouldBeIn (actual interface {} , expected interface {} ) string {
114
+ func shouldBeIn (actual any , expected any ) string {
115
115
if matchError := oglematchers .Contains (actual ).Matches (expected ); matchError != nil {
116
116
return fmt .Sprintf (shouldHaveBeenIn , actual , reflect .TypeOf (expected ))
117
117
}
@@ -122,7 +122,7 @@ func shouldBeIn(actual interface{}, expected interface{}) string {
122
122
// that is passed in either as the second parameter, or of the collection that consists
123
123
// of all the remaining parameters. This assertion ensures that the proposed member is NOT in
124
124
// the collection (using ShouldEqual).
125
- func ShouldNotBeIn (actual interface {} , expected ... interface {} ) string {
125
+ func ShouldNotBeIn (actual any , expected ... any ) string {
126
126
if fail := atLeast (1 , expected ); fail != success {
127
127
return fail
128
128
}
@@ -132,7 +132,7 @@ func ShouldNotBeIn(actual interface{}, expected ...interface{}) string {
132
132
}
133
133
return shouldNotBeIn (actual , expected )
134
134
}
135
- func shouldNotBeIn (actual interface {} , expected interface {} ) string {
135
+ func shouldNotBeIn (actual any , expected any ) string {
136
136
if matchError := oglematchers .Contains (actual ).Matches (expected ); matchError == nil {
137
137
return fmt .Sprintf (shouldNotHaveBeenIn , actual , reflect .TypeOf (expected ))
138
138
}
@@ -142,7 +142,7 @@ func shouldNotBeIn(actual interface{}, expected interface{}) string {
142
142
// ShouldBeEmpty receives a single parameter (actual) and determines whether
143
143
// calling len(actual) would return `0`. It obeys the rules specified by the len
144
144
// function for determining length: http://golang.org/pkg/builtin/#len
145
- func ShouldBeEmpty (actual interface {} , expected ... interface {} ) string {
145
+ func ShouldBeEmpty (actual any , expected ... any ) string {
146
146
if fail := need (0 , expected ); fail != success {
147
147
return fail
148
148
}
@@ -183,7 +183,7 @@ func ShouldBeEmpty(actual interface{}, expected ...interface{}) string {
183
183
// ShouldNotBeEmpty receives a single parameter (actual) and determines whether
184
184
// calling len(actual) would return a value greater than zero. It obeys the rules
185
185
// specified by the `len` function for determining length: http://golang.org/pkg/builtin/#len
186
- func ShouldNotBeEmpty (actual interface {} , expected ... interface {} ) string {
186
+ func ShouldNotBeEmpty (actual any , expected ... any ) string {
187
187
if fail := need (0 , expected ); fail != success {
188
188
return fail
189
189
}
@@ -198,7 +198,7 @@ func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string {
198
198
// the length of, the second being the expected length. It obeys the rules
199
199
// specified by the len function for determining length:
200
200
// http://golang.org/pkg/builtin/#len
201
- func ShouldHaveLength (actual interface {} , expected ... interface {} ) string {
201
+ func ShouldHaveLength (actual any , expected ... any ) string {
202
202
if fail := need (1 , expected ); fail != success {
203
203
return fail
204
204
}
0 commit comments