MCPcopy
hub / github.com/stretchr/testify / TestContainsWrapper

Function TestContainsWrapper

assert/forward_assertions_test.go:201–221  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

199}
200
201func TestContainsWrapper(t *testing.T) {
202 t.Parallel()
203
204 assert := New(new(testing.T))
205 list := []string{"Foo", "Bar"}
206
207 if !assert.Contains("Hello World", "Hello") {
208 t.Error("Contains should return true: \"Hello World\" contains \"Hello\"")
209 }
210 if assert.Contains("Hello World", "Salut") {
211 t.Error("Contains should return false: \"Hello World\" does not contain \"Salut\"")
212 }
213
214 if !assert.Contains(list, "Foo") {
215 t.Error("Contains should return true: \"[\"Foo\", \"Bar\"]\" contains \"Foo\"")
216 }
217 if assert.Contains(list, "Salut") {
218 t.Error("Contains should return false: \"[\"Foo\", \"Bar\"]\" does not contain \"Salut\"")
219 }
220
221}
222
223func TestNotContainsWrapper(t *testing.T) {
224 t.Parallel()

Callers

nothing calls this directly

Calls 3

NewFunction · 0.70
ContainsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected