From 84e2a3d3c70e73f0caa70725b19d00ec362fb7ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlado=20Paji=C4=87?= Date: Sun, 17 Nov 2024 18:43:03 +0100 Subject: [PATCH] add path test --- pkg/testcoverage/path/path_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 pkg/testcoverage/path/path_test.go diff --git a/pkg/testcoverage/path/path_test.go b/pkg/testcoverage/path/path_test.go new file mode 100644 index 00000000..a4e6a93a --- /dev/null +++ b/pkg/testcoverage/path/path_test.go @@ -0,0 +1,30 @@ +package path_test + +import ( + "runtime" + "testing" + + . "github.com/vladopajic/go-test-coverage/v2/pkg/testcoverage/path" + + "github.com/stretchr/testify/assert" +) + +func Test_NormalizeForOS(t *testing.T) { + t.Parallel() + + if runtime.GOOS == "windows" { + assert.Equal(t, "foo\\bar", NormalizeForOS("foo/bar")) + } else { + assert.Equal(t, "foo/bar", NormalizeForOS("foo/bar")) + } +} + +func Test_NormalizeForTool(t *testing.T) { + t.Parallel() + + if runtime.GOOS == "windows" { + assert.Equal(t, "foo/bar", NormalizeForTool("foo\\bar")) + } else { + assert.Equal(t, "foo/bar", NormalizeForTool("foo/bar")) + } +}