compiler: defer dir removal right after creation

This commit is contained in:
Evgenii Stratonikov 2020-12-10 13:40:27 +03:00
parent 76a6ddc3a4
commit c7ce9cd4f6

View file

@ -61,13 +61,13 @@ func TestCompiler(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
err = os.MkdirAll(exampleSavePath, os.ModePerm) err = os.MkdirAll(exampleSavePath, os.ModePerm)
require.NoError(t, err) require.NoError(t, err)
outfile := exampleSavePath + "/test.nef"
_, err = compiler.CompileAndSave(exampleCompilePath+"/"+infos[0].Name(), &compiler.Options{Outfile: outfile})
require.NoError(t, err)
defer func() { defer func() {
err := os.RemoveAll(exampleSavePath) err := os.RemoveAll(exampleSavePath)
require.NoError(t, err) require.NoError(t, err)
}() }()
outfile := exampleSavePath + "/test.nef"
_, err = compiler.CompileAndSave(exampleCompilePath+"/"+infos[0].Name(), &compiler.Options{Outfile: outfile})
require.NoError(t, err)
}, },
}, },
} }