mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 08:53:15 +01:00
Signed-off-by: Avi Deitcher <avi@deitcher.net> Signed-off-by: Keith Zantow <kzantow@gmail.com> Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Co-authored-by: Keith Zantow <kzantow@gmail.com> Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
28 lines
508 B
Go
28 lines
508 B
Go
package golang
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func Test_NewSubFS(t *testing.T) {
|
|
f := os.DirFS("test-fixtures/zip-fs")
|
|
f = newSubFS(f, "github.com/someorg/somepkg@version")
|
|
var names []string
|
|
err := fs.WalkDir(f, ".", func(path string, d fs.DirEntry, err error) error {
|
|
names = append(names, path)
|
|
return nil
|
|
})
|
|
require.NoError(t, err)
|
|
expected := []string{
|
|
".",
|
|
"a-file",
|
|
"subdir",
|
|
"subdir/subfile",
|
|
}
|
|
require.Equal(t, expected, names)
|
|
}
|