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

Function TestFormatter_FormatDiff

formatter_test.go:1068–1097  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1066}
1067
1068func TestFormatter_FormatDiff(t *testing.T) {
1069 t.Run("success", func(t *testing.T) {
1070 check := func(a, b interface{}) {
1071 formatter := &DefaultFormatter{}
1072 diff, ok := formatter.formatDiff(a, b)
1073 assert.True(t, ok)
1074 assert.NotEqual(t, "", diff)
1075 }
1076
1077 check(map[string]interface{}{"a": 1}, map[string]interface{}{})
1078 check([]interface{}{"a"}, []interface{}{})
1079 })
1080
1081 t.Run("failure", func(t *testing.T) {
1082 check := func(a, b interface{}) {
1083 formatter := &DefaultFormatter{}
1084 diff, ok := formatter.formatDiff(a, b)
1085 assert.False(t, ok)
1086 assert.Equal(t, "", diff)
1087 }
1088
1089 check(map[string]interface{}{}, []interface{}{})
1090 check([]interface{}{}, map[string]interface{}{})
1091 check("foo", "bar")
1092 check(func() {}, func() {})
1093
1094 check(map[string]interface{}{}, map[string]interface{}{})
1095 check([]interface{}{}, []interface{}{})
1096 })
1097}
1098
1099func TestFormatter_StacktraceMode(t *testing.T) {
1100 cases := []struct {

Callers

nothing calls this directly

Calls 5

formatDiffMethod · 0.95
TrueMethod · 0.80
FalseMethod · 0.80
NotEqualMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…