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

Function TestFormatter_StacktraceMode

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

Source from the content-addressed store, hash-verified

1097}
1098
1099func TestFormatter_StacktraceMode(t *testing.T) {
1100 cases := []struct {
1101 name string
1102 mode StacktraceMode
1103 want bool
1104 }{
1105 {
1106 name: "disabled",
1107 mode: StacktraceModeDisabled,
1108 want: false,
1109 },
1110 {
1111 name: "standard",
1112 mode: StacktraceModeStandard,
1113 want: true,
1114 },
1115 {
1116 name: "compact",
1117 mode: StacktraceModeCompact,
1118 want: true,
1119 },
1120 }
1121
1122 for _, tc := range cases {
1123 t.Run(tc.name, func(t *testing.T) {
1124 f := &DefaultFormatter{
1125 StacktraceMode: tc.mode,
1126 }
1127 fd := f.buildFormatData(&AssertionContext{}, &AssertionFailure{
1128 Stacktrace: stacktrace(),
1129 })
1130
1131 if tc.want {
1132 require.GreaterOrEqual(t, len(fd.Stacktrace), 1)
1133 assert.Contains(t, fd.Stacktrace[0], "TestFormatter_StacktraceMode.func")
1134 assert.Contains(t, fd.Stacktrace[0], "formatter_test.go")
1135 assert.Contains(t, fd.Stacktrace[0], "github.com/gavv/httpexpect")
1136 } else {
1137 assert.NotNil(t, fd.Stacktrace)
1138 assert.Equal(t, 0, len(fd.Stacktrace))
1139 }
1140 })
1141 }
1142}
1143
1144func TestFormatter_ColorMode(t *testing.T) {
1145 cases := []struct {

Callers

nothing calls this directly

Calls 4

buildFormatDataMethod · 0.95
stacktraceFunction · 0.85
ContainsMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…