From 746c287b262034e10ec65d9f99b232519a90546d Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sun, 12 Jan 2014 14:59:03 -0700 Subject: Add mock OS. --- os_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 os_test.go (limited to 'os_test.go') 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) +} -- cgit v1.2.3