Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for windows
Browse files Browse the repository at this point in the history
attiasas committed Sep 26, 2023
1 parent c6f29dd commit cb563be
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions xray/utils/sarifutils_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package utils

import (
"path"
"testing"

"github.com/owenrumney/go-sarif/v2/sarif"
@@ -301,22 +302,22 @@ func TestGetFullLocationFileName(t *testing.T) {
expectedOutput string
}{
{
file: "root/someDir/another/file",
file: path.Join("root","someDir","another","file"),
invocations: []*sarif.Invocation{},
expectedOutput: "root/someDir/another/file",
expectedOutput: path.Join("root","someDir","another","file"),
},
{
file: "/another/file",
file: path.Join("another","file"),
invocations: []*sarif.Invocation{
{WorkingDirectory: sarif.NewSimpleArtifactLocation("/root/someDir/")},
{WorkingDirectory: sarif.NewSimpleArtifactLocation("/not/relevant")},
{WorkingDirectory: sarif.NewSimpleArtifactLocation(path.Join("root","someDir"))},
{WorkingDirectory: sarif.NewSimpleArtifactLocation(path.Join("not","relevant"))},
},
expectedOutput: "/root/someDir/another/file",
expectedOutput: path.Join("root","someDir","another","file"),
},
{
file: "another/file",
invocations: []*sarif.Invocation{{WorkingDirectory: sarif.NewSimpleArtifactLocation("/root/someDir")}},
expectedOutput: "/root/someDir/another/file",
invocations: []*sarif.Invocation{{WorkingDirectory: sarif.NewSimpleArtifactLocation(path.Join("root","someDir"))}},
expectedOutput: path.Join("root","someDir","another","file"),
},
}

0 comments on commit cb563be

Please sign in to comment.