MCPcopy Create free account
hub / github.com/stretchr/testify / TestDiff

Function TestDiff

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

Source from the content-addressed store, hash-verified

2460}
2461
2462func TestDiff(t *testing.T) {
2463 expected := `
2464
2465Diff:
2466--- Expected
2467+++ Actual
2468@@ -1,3 +1,3 @@
2469 (struct { foo string }) {
2470- foo: (string) (len=5) "hello"
2471+ foo: (string) (len=3) "bar"
2472 }
2473`
2474 actual := diff(
2475 struct{ foo string }{"hello"},
2476 struct{ foo string }{"bar"},
2477 )
2478 Equal(t, expected, actual)
2479
2480 expected = `
2481
2482Diff:
2483--- Expected
2484+++ Actual
2485@@ -2,5 +2,5 @@
2486 (int) 1,
2487- (int) 2,
2488 (int) 3,
2489- (int) 4
2490+ (int) 5,
2491+ (int) 7
2492 }
2493`
2494 actual = diff(
2495 []int{1, 2, 3, 4},
2496 []int{1, 3, 5, 7},
2497 )
2498 Equal(t, expected, actual)
2499
2500 expected = `
2501
2502Diff:
2503--- Expected
2504+++ Actual
2505@@ -2,4 +2,4 @@
2506 (int) 1,
2507- (int) 2,
2508- (int) 3
2509+ (int) 3,
2510+ (int) 5
2511 }
2512`
2513 actual = diff(
2514 []int{1, 2, 3, 4}[0:3],
2515 []int{1, 3, 5, 7}[0:3],
2516 )
2517 Equal(t, expected, actual)
2518
2519 expected = `

Callers

nothing calls this directly

Calls 2

diffFunction · 0.70
EqualFunction · 0.70

Tested by

no test coverage detected