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
+2 -2
View File
@@ -2,7 +2,7 @@ package transform_test
import (
"go/token"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"sort"
@@ -62,7 +62,7 @@ func TestAllocs2(t *testing.T) {
}
// Load expected test output (the OUT: lines).
testInput, err := ioutil.ReadFile("./testdata/allocs2.go")
testInput, err := os.ReadFile("./testdata/allocs2.go")
if err != nil {
t.Fatal("could not read test input:", err)
}
+2 -3
View File
@@ -6,7 +6,6 @@ import (
"flag"
"go/token"
"go/types"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -58,13 +57,13 @@ func testTransform(t *testing.T, pathPrefix string, transform func(mod llvm.Modu
actual = actual[strings.Index(actual, "\ntarget datalayout = ")+1:]
if *update {
err := ioutil.WriteFile(pathPrefix+".out.ll", []byte(actual), 0666)
err := os.WriteFile(pathPrefix+".out.ll", []byte(actual), 0666)
if err != nil {
t.Error("failed to write out new output:", err)
}
} else {
// Read the expected output IR.
out, err := ioutil.ReadFile(pathPrefix + ".out.ll")
out, err := os.ReadFile(pathPrefix + ".out.ll")
if err != nil {
t.Fatalf("could not read output file %s: %v", pathPrefix+".out.ll", err)
}