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

Function TestDiff

assert/assertions_test.go:2851–2985  ·  assert/assertions_test.go::TestDiff
(t *testing.T)

Source from the content-addressed store, hash-verified

2849}
2850
2851func TestDiff(t *testing.T) {
2852 t.Parallel()
2853
2854 expected := `
2855
2856Diff:
2857--- Expected
2858+++ Actual
2859@@ -1,3 +1,3 @@
2860 (struct { foo string }) {
2861- foo: (string) (len=5) "hello"
2862+ foo: (string) (len=3) "bar"
2863 }
2864`
2865 actual := diff(
2866 struct{ foo string }{"hello"},
2867 struct{ foo string }{"bar"},
2868 )
2869 Equal(t, expected, actual)
2870
2871 expected = `
2872
2873Diff:
2874--- Expected
2875+++ Actual
2876@@ -2,5 +2,5 @@
2877 (int) 1,
2878- (int) 2,
2879 (int) 3,
2880- (int) 4
2881+ (int) 5,
2882+ (int) 7
2883 }
2884`
2885 actual = diff(
2886 []int{1, 2, 3, 4},
2887 []int{1, 3, 5, 7},
2888 )
2889 Equal(t, expected, actual)
2890
2891 expected = `
2892
2893Diff:
2894--- Expected
2895+++ Actual
2896@@ -2,4 +2,4 @@
2897 (int) 1,
2898- (int) 2,
2899- (int) 3
2900+ (int) 3,
2901+ (int) 5
2902 }
2903`
2904 actual = diff(
2905 []int{1, 2, 3, 4}[0:3],
2906 []int{1, 3, 5, 7}[0:3],
2907 )
2908 Equal(t, expected, actual)

Callers

nothing calls this directly

Calls 2

diffFunction · 0.70
EqualFunction · 0.70

Tested by

no test coverage detected