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

Function TestEqualExportedValues

assert/assertions_test.go:375–528  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

373}
374
375func TestEqualExportedValues(t *testing.T) {
376 t.Parallel()
377
378 cases := []struct {
379 value1 interface{}
380 value2 interface{}
381 expectedEqual bool
382 expectedFail string
383 }{
384 {
385 value1: S{1, Nested{2, 3}, 4, Nested{5, 6}},
386 value2: S{1, Nested{2, nil}, nil, Nested{}},
387 expectedEqual: true,
388 },
389 {
390 value1: S{1, Nested{2, 3}, 4, Nested{5, 6}},
391 value2: S{1, Nested{1, nil}, nil, Nested{}},
392 expectedEqual: false,
393 expectedFail: `
394 Diff:
395 --- Expected
396 +++ Actual
397 @@ -3,3 +3,3 @@
398 Exported2: (assert.Nested) {
399 - Exported: (int) 2,
400 + Exported: (int) 1,
401 notExported: (interface {}) <nil>`,
402 },
403 {
404 value1: S3{&Nested{1, 2}, &Nested{3, 4}},
405 value2: S3{&Nested{"a", 2}, &Nested{3, 4}},
406 expectedEqual: false,
407 expectedFail: `
408 Diff:
409 --- Expected
410 +++ Actual
411 @@ -2,3 +2,3 @@
412 Exported1: (*assert.Nested)({
413 - Exported: (int) 1,
414 + Exported: (string) (len=1) "a",
415 notExported: (interface {}) <nil>`,
416 },
417 {
418 value1: S4{[]*Nested{
419 {1, 2},
420 {3, 4},
421 }},
422 value2: S4{[]*Nested{
423 {1, "a"},
424 {2, "b"},
425 }},
426 expectedEqual: false,
427 expectedFail: `
428 Diff:
429 --- Expected
430 +++ Actual
431 @@ -7,3 +7,3 @@
432 (*assert.Nested)({

Callers

nothing calls this directly

Calls 5

errorStringMethod · 0.80
EqualExportedValuesFunction · 0.70
ErrorfMethod · 0.65
RunMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected