🐛 Only trim bang on out

This commit is contained in:
Dan Jones 2024-10-31 15:09:42 -05:00
commit 0b2e178066
4 changed files with 20 additions and 5 deletions

View file

@ -33,6 +33,14 @@ func TestWriteBuffer(t *testing.T) {
{"slice", []any{1, 2, "foo"}, `[1,2,"foo"]`, nil},
{"map", map[string]any{"baz": 42, "foo": "bar"}, `{"baz":42,"foo":"bar"}`, nil},
{"struct", struct{}{}, "", errors.New("Unsupported type struct {}")},
{"skip-bang-num", "!42", "42", nil},
{"skip-bang-bool", "!false", "false", nil},
{"skip-bang-time", "!" + when.Format(time.RFC3339), when.Format(time.RFC3339), nil},
{"skip-bang-duration", "!15 mins", "15 mins", nil},
{"skip-bang-bytes-num", []byte("!42"), "42", nil},
{"skip-bang-bytes-bool", []byte("!false"), "false", nil},
{"skip-bang-bytes-time", []byte("!" + when.Format(time.RFC3339)), when.Format(time.RFC3339), nil},
{"skip-bang-bytes-duration", []byte("!15 mins"), "15 mins", nil},
}
for _, tt := range tests {