mirror of
https://github.com/anchore/syft.git
synced 2026-08-20 09:08:28 +02:00
* add squash all layers resolver Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * add squash with all layers logic Signed-off-by: tomersein <tomersein@gmail.com> * add squash with all layers logic Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squashed all layers Signed-off-by: tomersein <tomersein@gmail.com> * squash with all layers Signed-off-by: tomersein <tomersein@gmail.com> * squash with all layers Signed-off-by: tomersein <tomersein@gmail.com> * adjust resolver to strictly return squash paths only Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * show all packages have locations + primary evidence Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * fix race condition in test Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * consider access paths Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: tomersein <tomersein@gmail.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
88 lines
1.2 KiB
Go
88 lines
1.2 KiB
Go
package source
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestParseScope(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
want Scope
|
|
}{
|
|
// go cases
|
|
{
|
|
name: "squashed",
|
|
want: SquashedScope,
|
|
},
|
|
{
|
|
name: "all-layers",
|
|
want: AllLayersScope,
|
|
},
|
|
|
|
{
|
|
name: "deep-squashed",
|
|
want: DeepSquashedScope,
|
|
},
|
|
// fall back to unknown
|
|
{
|
|
name: "make-believe",
|
|
want: UnknownScope,
|
|
},
|
|
{
|
|
name: "",
|
|
want: UnknownScope,
|
|
},
|
|
{
|
|
name: " ",
|
|
want: UnknownScope,
|
|
},
|
|
// to support the original value
|
|
|
|
{
|
|
name: "Squashed",
|
|
want: SquashedScope,
|
|
},
|
|
{
|
|
name: "AllLayers",
|
|
want: AllLayersScope,
|
|
},
|
|
// case insensitive
|
|
{
|
|
name: "alLlaYerS",
|
|
want: AllLayersScope,
|
|
},
|
|
// aliases
|
|
{
|
|
name: "all",
|
|
want: AllLayersScope,
|
|
},
|
|
{
|
|
name: "deep-squash",
|
|
want: DeepSquashedScope,
|
|
},
|
|
{
|
|
name: "deepsquashed",
|
|
want: DeepSquashedScope,
|
|
},
|
|
{
|
|
name: "squasheddeep",
|
|
want: DeepSquashedScope,
|
|
},
|
|
{
|
|
name: "squashed-deep",
|
|
want: DeepSquashedScope,
|
|
},
|
|
{
|
|
name: "deepsquash",
|
|
want: DeepSquashedScope,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
assert.Equal(t, tt.want, ParseScope(tt.name))
|
|
})
|
|
}
|
|
}
|