mirror of
https://github.com/anchore/grype
synced 2024-11-14 00:07:08 +00:00
9050883715
* 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>
38 lines
516 B
Go
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)
|
|
})
|
|
}
|
|
}
|