Skip to content

Commit

Permalink
refactor: use ToSlash for sbom_test
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Mar 18, 2024
1 parent a1fa7ad commit 6d19804
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions integration/sbom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
package integration

import (
ftypes "github.com/aquasecurity/trivy/pkg/fanal/types"
"path/filepath"
"strings"
"testing"

ftypes "github.com/aquasecurity/trivy/pkg/fanal/types"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -243,9 +242,9 @@ func compareSBOMReports(t *testing.T, wantFile, gotFile string, overrideWant typ

got := readReport(t, gotFile)
// when running on Windows FS
got.ArtifactName = strings.ReplaceAll(got.ArtifactName, "\\", "/")
got.ArtifactName = filepath.ToSlash(filepath.Clean(got.ArtifactName))
for i, result := range got.Results {
got.Results[i].Target = strings.ReplaceAll(result.Target, "\\", "/")
got.Results[i].Target = filepath.ToSlash(filepath.Clean(result.Target))
}
assert.Equal(t, want, got)
}

0 comments on commit 6d19804

Please sign in to comment.