ForgetFSTest.Open_ManyTimes

geesefs-0-30-9
Aaron Jacobs 2015-03-31 10:06:06 +11:00
parent a11be99f88
commit ea13e766fd
1 changed files with 22 additions and 1 deletions

View File

@ -15,6 +15,7 @@
package forgetfs_test
import (
"io"
"os"
"path"
"testing"
@ -76,7 +77,27 @@ func (t *ForgetFSTest) Open_Bar() {
}
func (t *ForgetFSTest) Open_ManyTimes() {
AssertTrue(false, "TODO")
// Set up a slice of files that will be closed when we're done.
var toClose []io.Closer
defer func() {
for _, c := range toClose {
ExpectEq(nil, c.Close())
}
}()
// Open foo many times.
for i := 0; i < 100; i++ {
f, err := os.Open(path.Join(t.Dir, "foo"))
AssertEq(nil, err)
toClose = append(toClose, f)
}
// Open bar many times.
for i := 0; i < 100; i++ {
f, err := os.Open(path.Join(t.Dir, "bar"))
AssertEq(nil, err)
toClose = append(toClose, f)
}
}
func (t *ForgetFSTest) Stat_Foo() {