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>
34 lines
576 B
Go
34 lines
576 B
Go
package golang
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/go-git/go-git/v5"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func Test_billyFSAdapter(t *testing.T) {
|
|
r, err := git.PlainInit("test-fixtures/repo", false)
|
|
|
|
t.Cleanup(func() {
|
|
_ = os.RemoveAll("test-fixtures/repo/.git")
|
|
})
|
|
|
|
wt, err := r.Worktree()
|
|
require.NoError(t, err)
|
|
f := billyFSAdapter{
|
|
fs: wt.Filesystem,
|
|
}
|
|
|
|
found := ""
|
|
err = fs.WalkDir(f, ".", func(path string, d fs.DirEntry, err error) error {
|
|
found = path
|
|
return nil
|
|
})
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, "LICENSE", found)
|
|
}
|