mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
all: update _test.go files for ioutil changes
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user