*: make tests use TempDir(), fix #1319

Simplify things, drop TempFile at the same time (refs. #1764)
This commit is contained in:
Roman Khimov 2021-08-25 22:17:37 +03:00
parent f4ba21a41a
commit 6d074a96e9
16 changed files with 93 additions and 308 deletions

View file

@ -162,11 +162,7 @@ func TestLoad(t *testing.T) {
return a * b
}
}`
tmpDir, err := ioutil.TempDir("", "neogo.vmcliloadtest")
require.NoError(t, err)
t.Cleanup(func() {
os.RemoveAll(tmpDir)
})
tmpDir := t.TempDir()
t.Run("loadgo", func(t *testing.T) {
filename := path.Join(tmpDir, "vmtestcontract.go")
@ -262,11 +258,7 @@ func TestRunWithDifferentArguments(t *testing.T) {
return arg
}`
tmpDir, err := ioutil.TempDir("", "neogo.vmcliruntest")
require.NoError(t, err)
t.Cleanup(func() {
os.RemoveAll(tmpDir)
})
tmpDir := t.TempDir()
filename := path.Join(tmpDir, "run_vmtestcontract.go")
require.NoError(t, ioutil.WriteFile(filename, []byte(src), os.ModePerm))