mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 15:06:36 +01:00
* migrate location structs to file package Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * replace source.Location refs with file package call Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix linting Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * remove hardlink test for file based catalogers Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * remove hardlink test for all-regular-files testing Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * migrate file resolver implementations to separate package Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix linting Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * [wip] migrate resolvers to internal Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * migrate resolvers to syft/internal Signed-off-by: Alex Goodman <alex.goodman@anchore.com> --------- Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Signed-off-by: <>
51 lines
1001 B
Go
51 lines
1001 B
Go
package file
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/anchore/stereoscope/pkg/file"
|
|
)
|
|
|
|
func TestLocation_ID(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
coordinates Coordinates
|
|
virtualPath string
|
|
ref file.Reference
|
|
}{
|
|
{
|
|
name: "coordinates should match location hash",
|
|
coordinates: Coordinates{
|
|
RealPath: "path!",
|
|
FileSystemID: "filesystem!",
|
|
},
|
|
},
|
|
{
|
|
name: "coordinates should match location hash (with extra fields)",
|
|
coordinates: Coordinates{
|
|
RealPath: "path!",
|
|
FileSystemID: "filesystem!",
|
|
},
|
|
virtualPath: "virtualPath!",
|
|
ref: file.Reference{
|
|
RealPath: "other-real-path!",
|
|
},
|
|
},
|
|
}
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
l := Location{
|
|
LocationData: LocationData{
|
|
Coordinates: test.coordinates,
|
|
VirtualPath: test.virtualPath,
|
|
ref: test.ref,
|
|
},
|
|
}
|
|
assert.Equal(t, l.ID(), test.coordinates.ID())
|
|
})
|
|
}
|
|
|
|
}
|