Skip to content

Commit

Permalink
Fixing unix test
Browse files Browse the repository at this point in the history
Signed-off-by: quobix <[email protected]>
  • Loading branch information
daveshanley committed Jan 15, 2024
1 parent b9bef26 commit cb9542a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions utils/windows_drive_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package utils

import (
"os"
"runtime"
"testing"
)
Expand All @@ -22,15 +23,22 @@ func TestReplaceWindowsDriveWithLinuxPath(t *testing.T) {
}

func TestCheckPathOverlap(t *testing.T) {
pathA := `C:\Users\pb33f`
pathB := `pb33f\files\thing.yaml`
expected := `C:\Users\pb33f\files\thing.yaml`
if runtime.GOOS != "windows" {
expected = `/Users/pb33f/files/thing.yaml`
}
result := CheckPathOverlap(pathA, pathB, `\`)
if result != expected {
t.Errorf("Expected %s, got %s", expected, result)
if runtime.GOOS == "windows" {
pathA := `C:\Users\pb33f`
pathB := `pb33f\files\thing.yaml`
expected := `C:\Users\pb33f\files\thing.yaml`
result := CheckPathOverlap(pathA, pathB, string(os.PathSeparator))
if result != expected {
t.Errorf("Expected %s, got %s", expected, result)
}
} else {
pathA := `/Users/pb33f`
pathB := `pb33f/files/thing.yaml`
expected := `/Users/pb33f/files/thing.yaml`
result := CheckPathOverlap(pathA, pathB, string(os.PathSeparator))
if result != expected {
t.Errorf("Expected %s, got %s", expected, result)
}
}
}

Expand Down

0 comments on commit cb9542a

Please sign in to comment.