MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestString_Contains

Function TestString_Contains

string_test.go:329–373  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

327}
328
329func TestString_Contains(t *testing.T) {
330 cases := []struct {
331 name string
332 str string
333 value string
334 wantContains chainResult
335 wantContainsFold chainResult
336 }{
337 {
338 name: "contains",
339 str: "11-foo-22",
340 value: "foo",
341 wantContains: success,
342 wantContainsFold: success,
343 },
344 {
345 name: "not contains",
346 str: "11-foo-22",
347 value: "bar",
348 wantContains: failure,
349 wantContainsFold: failure,
350 },
351 {
352 name: "different case",
353 str: "11-foo-22",
354 value: "FOO",
355 wantContains: failure,
356 wantContainsFold: success,
357 },
358 }
359
360 for _, tc := range cases {
361 reporter := newMockReporter(t)
362
363 NewString(reporter, tc.str).Contains(tc.value).
364 chain.assert(t, tc.wantContains)
365 NewString(reporter, tc.str).NotContains(tc.value).
366 chain.assert(t, !tc.wantContains)
367
368 NewString(reporter, tc.str).ContainsFold(tc.value).
369 chain.assert(t, tc.wantContainsFold)
370 NewString(reporter, tc.str).NotContainsFold(tc.value).
371 chain.assert(t, !tc.wantContainsFold)
372 }
373}
374
375func TestString_HasPrefix(t *testing.T) {
376 cases := []struct {

Callers

nothing calls this directly

Calls 7

newMockReporterFunction · 0.85
NewStringFunction · 0.85
assertMethod · 0.80
ContainsFoldMethod · 0.80
NotContainsFoldMethod · 0.80
ContainsMethod · 0.45
NotContainsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…