Skip to content

Commit 565afa9

Browse files
committed
rename to Normalize
1 parent 83ca143 commit 565afa9

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

pkg/testcoverage/coverage/cover_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func Test_findFile(t *testing.T) {
9999
return
100100
}
101101

102-
filename := path.NormalizePath("pkg/testcoverage/coverage/cover.go")
102+
filename := path.Normalize("pkg/testcoverage/coverage/cover.go")
103103

104104
file, noPrefixName, err := FindFile(prefix+"/"+filename, "")
105105
assert.NoError(t, err)

pkg/testcoverage/coverage/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func stripPrefix(name, prefix string) string {
4040
prefix += "/"
4141
}
4242

43-
prefix = path.NormalizePath(prefix)
43+
prefix = path.Normalize(prefix)
4444

4545
if i := strings.Index(name, prefix); i >= 0 {
4646
return name[i+len(prefix):]

pkg/testcoverage/coverage/types_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,24 @@ func TestStripPrefix(t *testing.T) {
3939
noPrefix string
4040
}{
4141
{
42-
file: path.NormalizePath("github.com/example/foo/bar.go"),
42+
file: path.Normalize("github.com/example/foo/bar.go"),
4343
prefix: "github.com/example",
44-
noPrefix: path.NormalizePath("foo/bar.go"),
44+
noPrefix: path.Normalize("foo/bar.go"),
4545
},
4646
{
47-
file: path.NormalizePath("github.com/example/foo/bar.go"),
47+
file: path.Normalize("github.com/example/foo/bar.go"),
4848
prefix: "github.com/example/",
49-
noPrefix: path.NormalizePath("foo/bar.go"),
49+
noPrefix: path.Normalize("foo/bar.go"),
5050
},
5151
{
52-
file: path.NormalizePath("github.com/example/foo/bar.go"),
52+
file: path.Normalize("github.com/example/foo/bar.go"),
5353
prefix: "example/foo",
54-
noPrefix: path.NormalizePath("bar.go"),
54+
noPrefix: path.Normalize("bar.go"),
5555
},
5656
{
57-
file: path.NormalizePath("github.com/example/foo/bar.go"),
57+
file: path.Normalize("github.com/example/foo/bar.go"),
5858
prefix: "github.com/example1/",
59-
noPrefix: path.NormalizePath("github.com/example/foo/bar.go"),
59+
noPrefix: path.Normalize("github.com/example/foo/bar.go"),
6060
},
6161
}
6262

pkg/testcoverage/path/path.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
const separatorToReplace = string(filepath.Separator)
1010

11-
func NormalizePath(path string) string {
11+
func Normalize(path string) string {
1212
if runtime.GOOS != "windows" {
1313
return path
1414
}

pkg/testcoverage/path/path_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ func Test_NormalizePath_NoWin(t *testing.T) {
2929
}
3030

3131
for _, tc := range tests {
32-
output := NormalizePath(tc.input)
33-
assert.Equal(t, tc.output, output)
32+
assert.Equal(t, tc.output, Normalize(tc.input))
3433
}
3534
}
3635

@@ -49,7 +48,6 @@ func Test_NormalizePath_Win(t *testing.T) {
4948
}
5049

5150
for _, tc := range tests {
52-
output := NormalizePath(tc.input)
53-
assert.Equal(t, tc.output, output)
51+
assert.Equal(t, tc.output, Normalize(tc.input))
5452
}
5553
}

0 commit comments

Comments
 (0)