grype/internal/format/format_test.go
Olivier Boudet 9050883715
feat(outputs): allow to set multiple outputs (#648) (#1346)
* feat(outputs): allow to set multiple outputs (#648)

Signed-off-by: Olivier Boudet <o.boudet@gmail.com>
Signed-off-by: Olivier Boudet <olivier.boudet@cooperl.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* feat(outputs): allow to set multiple outputs (#648)

review

Signed-off-by: Olivier Boudet <olivier.boudet@cooperl.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* use syft format writter pattern and de-emphasize presenter package

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Olivier Boudet <o.boudet@gmail.com>
Signed-off-by: Olivier Boudet <olivier.boudet@cooperl.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
2023-07-11 17:37:17 +00:00

38 lines
516 B
Go

package format
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParse(t *testing.T) {
cases := []struct {
input string
expected Format
}{
{
"",
TableFormat,
},
{
"table",
TableFormat,
},
{
"jSOn",
JSONFormat,
},
{
"booboodepoopoo",
UnknownFormat,
},
}
for _, tc := range cases {
t.Run(tc.input, func(t *testing.T) {
actual := Parse(tc.input)
assert.Equal(t, tc.expected, actual, "unexpected result for input %q", tc.input)
})
}
}