diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-12 14:59:03 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-12 14:59:03 -0700 |
commit | 746c287b262034e10ec65d9f99b232519a90546d (patch) | |
tree | 4c104ed92b08369eb3d31615939edcf02b6833b0 /os_test.go | |
parent | Initial db.open. (diff) | |
download | dedo-746c287b262034e10ec65d9f99b232519a90546d.tar.gz dedo-746c287b262034e10ec65d9f99b232519a90546d.tar.xz |
Add mock OS.
Diffstat (limited to 'os_test.go')
-rw-r--r-- | os_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/os_test.go b/os_test.go new file mode 100644 index 0000000..17ab09f --- /dev/null +++ b/os_test.go @@ -0,0 +1,26 @@ +package bolt + +import ( + "os" + + "github.com/stretchr/testify/mock" +) + +type mockos struct { + mock.Mock +} + +func (m *mockos) OpenFile(name string, flag int, perm os.FileMode) (file *os.File, err error) { + args := m.Called(name, flag, perm) + return args.Get(0).(*os.File), args.Error(1) +} + +func (m *mockos) Stat(name string) (fi os.FileInfo, err error) { + args := m.Called(name) + return args.Get(0).(os.FileInfo), args.Error(1) +} + +func (m *mockos) Getpagesize() int { + args := m.Called() + return args.Int(0) +} |