replace io/ioutil with os
This commit is contained in:
parent
d3efb410d0
commit
6d24d0da7a
@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
@ -28,7 +27,7 @@ func TestExecute(t *testing.T) {
|
|||||||
infile: "t10-in.txt",
|
infile: "t10-in.txt",
|
||||||
fixture: func(t *testing.T, dir string) {
|
fixture: func(t *testing.T, dir string) {
|
||||||
fname := filepath.Join(dir, "t10-in.txt")
|
fname := filepath.Join(dir, "t10-in.txt")
|
||||||
if err := ioutil.WriteFile(fname, _foo, 0644); err != nil {
|
if err := os.WriteFile(fname, _foo, 0644); err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -39,7 +38,7 @@ func TestExecute(t *testing.T) {
|
|||||||
infile: "t20-in.txt",
|
infile: "t20-in.txt",
|
||||||
fixture: func(t *testing.T, dir string) {
|
fixture: func(t *testing.T, dir string) {
|
||||||
fname := filepath.Join(dir, "t20-in.txt")
|
fname := filepath.Join(dir, "t20-in.txt")
|
||||||
if err := ioutil.WriteFile(fname, _foo, 0644); err != nil {
|
if err := os.WriteFile(fname, _foo, 0644); err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -50,7 +49,7 @@ func TestExecute(t *testing.T) {
|
|||||||
infile: "t30-in.txt",
|
infile: "t30-in.txt",
|
||||||
fixture: func(t *testing.T, dir string) {
|
fixture: func(t *testing.T, dir string) {
|
||||||
fname := filepath.Join(dir, "t30-in.txt")
|
fname := filepath.Join(dir, "t30-in.txt")
|
||||||
if err := ioutil.WriteFile(fname, _foo, 0644); err != nil {
|
if err := os.WriteFile(fname, _foo, 0644); err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -122,7 +121,7 @@ func TestExecute(t *testing.T) {
|
|||||||
if tt.outfile == "-" {
|
if tt.outfile == "-" {
|
||||||
out = stdout.Bytes()
|
out = stdout.Bytes()
|
||||||
} else {
|
} else {
|
||||||
out, err = ioutil.ReadFile(tt.outfile)
|
out, err = os.ReadFile(tt.outfile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user