(t *testing.T)
| 1066 | } |
| 1067 | |
| 1068 | func 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 | |
| 1099 | func TestFormatter_StacktraceMode(t *testing.T) { |
| 1100 | cases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…