afero/basepath_test.go

20 lines
396 B
Go
Raw Normal View History

package afero
import (
"testing"
)
func TestBasePath(t *testing.T) {
baseFs := &MemMapFs{}
baseFs.MkdirAll("/base/path/tmp", 0777)
2016-01-12 00:32:08 +03:00
bp := &BasePathFs{source: baseFs, path: "/base/path"}
if _, err := bp.Create("/tmp/foo"); err != nil {
t.Errorf("Failed to set real path")
}
if fh, err := bp.Create("../tmp/bar"); err == nil {
t.Errorf("succeeded in creating %s ...", fh.Name())
}
}