This commit is contained in:
Aliaksandr Valialkin 2024-05-20 16:51:18 +02:00
parent f4ac7c50b6
commit 01f63b9e94
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB

View file

@ -4,6 +4,33 @@ import (
"testing"
)
func TestParsePipeUnpackLogfmtSuccess(t *testing.T) {
f := func(pipeStr string) {
t.Helper()
expectParsePipeSuccess(t, pipeStr)
}
f(`unpack_logfmt`)
f(`unpack_logfmt from x`)
f(`unpack_logfmt from x result_prefix abc`)
f(`unpack_logfmt result_prefix abc`)
}
func TestParsePipeUnpackLogfmtFailure(t *testing.T) {
f := func(pipeStr string) {
t.Helper()
expectParsePipeFailure(t, pipeStr)
}
f(`unpack_logfmt foo`)
f(`unpack_logfmt from`)
f(`unpack_logfmt from x y`)
f(`unpack_logfmt from x result_prefix`)
f(`unpack_logfmt from x result_prefix a b`)
f(`unpack_logfmt result_prefix`)
f(`unpack_logfmt result_prefix a b`)
}
func TestPipeUnpackLogfmt(t *testing.T) {
f := func(pipeStr string, rows, rowsExpected [][]Field) {
t.Helper()