Skip to content

Commit cb4ecd9

Browse files
kolyshkingopherbot
authored andcommitted
unix: use filepath in tests where appropriate
Change-Id: I0b80cdf4fcf48b80139bf4439f4c78954c972382 Reviewed-on: https://go-review.googlesource.com/c/sys/+/527155 TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Tobias Klauser <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]>
1 parent 4848eb0 commit cb4ecd9

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

unix/syscall_darwin_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"io/ioutil"
1010
"net"
1111
"os"
12-
"path"
12+
"path/filepath"
1313
"testing"
1414

1515
"golang.org/x/sys/unix"
@@ -126,8 +126,8 @@ func TestClonefileatWithRelativePaths(t *testing.T) {
126126
t.Fatal(err)
127127
}
128128

129-
src := path.Base(srcFile.Name())
130-
dst := path.Base(dstFile.Name())
129+
src := filepath.Base(srcFile.Name())
130+
dst := filepath.Base(dstFile.Name())
131131
err = unix.Clonefileat(srcFd, src, dstFd, dst, 0)
132132
if err == unix.ENOSYS || err == unix.ENOTSUP {
133133
t.Skip("clonefileat is not available or supported, skipping test")

unix/syscall_freebsd_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"net"
1414
"os"
1515
"os/exec"
16-
"path"
1716
"path/filepath"
1817
"runtime"
1918
"testing"
@@ -102,7 +101,7 @@ const testfile = "gocapmodetest"
102101
const testfile2 = testfile + "2"
103102

104103
func CapEnterTest() {
105-
_, err := os.OpenFile(path.Join(procArg, testfile), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
104+
_, err := os.OpenFile(filepath.Join(procArg, testfile), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
106105
if err != nil {
107106
panic(fmt.Sprintf("OpenFile: %s", err))
108107
}
@@ -112,7 +111,7 @@ func CapEnterTest() {
112111
panic(fmt.Sprintf("CapEnter: %s", err))
113112
}
114113

115-
_, err = os.OpenFile(path.Join(procArg, testfile2), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
114+
_, err = os.OpenFile(filepath.Join(procArg, testfile2), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
116115
if err == nil {
117116
panic("OpenFile works!")
118117
}

0 commit comments

Comments
 (0)