all: update _test.go files for ioutil changes

This commit is contained in:
Damian Gryski
2022-08-05 16:20:39 -07:00
committed by Ron Evans
parent 1784bcd728
commit f9ba99344a
9 changed files with 18 additions and 22 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ package os_test
import (
"io/fs"
"io/ioutil"
"os"
. "os"
"path/filepath"
"runtime"
@@ -198,13 +198,13 @@ func TestRenameOverwriteDest(t *testing.T) {
toData := []byte("to")
fromData := []byte("from")
err := ioutil.WriteFile(to, toData, 0777)
err := os.WriteFile(to, toData, 0777)
defer Remove(to) // TODO: switch to t.Tempdir, remove this line
if err != nil {
t.Fatalf("write file %q failed: %v", to, err)
}
err = ioutil.WriteFile(from, fromData, 0777)
err = os.WriteFile(from, fromData, 0777)
defer Remove(from) // TODO: switch to t.Tempdir, remove this line
if err != nil {
t.Fatalf("write file %q failed: %v", from, err)
+2 -2
View File
@@ -6,7 +6,7 @@ package os_test
import (
"io"
"io/ioutil"
"os"
. "os"
"runtime"
"strings"
@@ -129,7 +129,7 @@ func TestSeek(t *testing.T) {
off, err := f.Seek(tt.in, tt.whence)
if off != tt.out || err != nil {
if e, ok := err.(*PathError); ok && e.Err == syscall.EINVAL && tt.out > 1<<32 && runtime.GOOS == "linux" {
mounts, _ := ioutil.ReadFile("/proc/mounts")
mounts, _ := os.ReadFile("/proc/mounts")
if strings.Contains(string(mounts), "reiserfs") {
// Reiserfs rejects the big seeks.
t.Skipf("skipping test known to fail on reiserfs; https://golang.org/issue/91")