Added test setup and tear-down code.

geesefs-0-30-9
Aaron Jacobs 2015-03-05 19:08:48 +11:00
parent 9fd18f53f4
commit e435f6916c
1 changed files with 18 additions and 2 deletions

View File

@ -18,6 +18,8 @@
package memfs_test
import (
"io/ioutil"
"os"
"testing"
. "github.com/jacobsa/ogletest"
@ -38,9 +40,23 @@ var _ TearDownInterface = &PosixTest{}
func init() { RegisterTestSuite(&PosixTest{}) }
func (t *PosixTest) SetUp(ti *TestInfo)
func (t *PosixTest) SetUp(ti *TestInfo) {
var err error
func (t *PosixTest) TearDown()
// Create a temporary directory.
t.dir, err = ioutil.TempDir("", "posix_test")
if err != nil {
panic(err)
}
}
func (t *PosixTest) TearDown() {
// Remove the temporary directory.
err := os.RemoveAll(t.dir)
if err != nil {
panic(err)
}
}
////////////////////////////////////////////////////////////////////////
// Test functions