Skip to content

Commit 84e2a3d

Browse files
committed
add path test
1 parent 34a0930 commit 84e2a3d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pkg/testcoverage/path/path_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package path_test
2+
3+
import (
4+
"runtime"
5+
"testing"
6+
7+
. "github.com/vladopajic/go-test-coverage/v2/pkg/testcoverage/path"
8+
9+
"github.com/stretchr/testify/assert"
10+
)
11+
12+
func Test_NormalizeForOS(t *testing.T) {
13+
t.Parallel()
14+
15+
if runtime.GOOS == "windows" {
16+
assert.Equal(t, "foo\\bar", NormalizeForOS("foo/bar"))
17+
} else {
18+
assert.Equal(t, "foo/bar", NormalizeForOS("foo/bar"))
19+
}
20+
}
21+
22+
func Test_NormalizeForTool(t *testing.T) {
23+
t.Parallel()
24+
25+
if runtime.GOOS == "windows" {
26+
assert.Equal(t, "foo/bar", NormalizeForTool("foo\\bar"))
27+
} else {
28+
assert.Equal(t, "foo/bar", NormalizeForTool("foo/bar"))
29+
}
30+
}

0 commit comments

Comments
 (0)