mirror of
https://github.com/anchore/syft.git
synced 2026-11-02 07:26:34 +01:00
Fix directory resolver to consider CWD and root path input correctly (#1840)
* [wip] put in initial fix Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * capture expected behavior of dir resolver in tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update tests + comments to reflect current dir resolver behavior Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add additional test cases Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix linting Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix additional tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix bad merge conflict resolution Signed-off-by: Alex Goodman <alex.goodman@anchore.com> --------- Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/anchore/syft/syft/file"
|
||||
"github.com/anchore/syft/syft/pkg"
|
||||
"github.com/anchore/syft/syft/sbom"
|
||||
"github.com/anchore/syft/syft/source"
|
||||
)
|
||||
|
||||
// TODO: Add ToFormatModel tests
|
||||
@@ -505,14 +504,14 @@ func Test_toSPDXID(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "short filename",
|
||||
it: source.Coordinates{
|
||||
it: file.Coordinates{
|
||||
RealPath: "/short/path/file.txt",
|
||||
},
|
||||
expected: "File-short-path-file.txt",
|
||||
},
|
||||
{
|
||||
name: "long filename",
|
||||
it: source.Coordinates{
|
||||
it: file.Coordinates{
|
||||
RealPath: "/some/long/path/with/a/lot/of-text/that-contains-a/file.txt",
|
||||
},
|
||||
expected: "File-...a-lot-of-text-that-contains-a-file.txt",
|
||||
|
||||
Reference in New Issue
Block a user