aboutsummaryrefslogtreecommitdiff
path: root/file_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-01-12 15:30:09 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-01-12 15:30:09 -0700
commit28c1e86a27b2dc3ba59b8c4d69f15a8e54334a89 (patch)
tree0ceb5ed513345f4d52fe419cb635bd6b6aed31de /file_test.go
parentAdd mock OS. (diff)
downloaddedo-28c1e86a27b2dc3ba59b8c4d69f15a8e54334a89.tar.gz
dedo-28c1e86a27b2dc3ba59b8c4d69f15a8e54334a89.tar.xz
Mock OS and File.
Diffstat (limited to 'file_test.go')
-rw-r--r--file_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/file_test.go b/file_test.go
new file mode 100644
index 0000000..3f33d14
--- /dev/null
+++ b/file_test.go
@@ -0,0 +1,29 @@
+package bolt
+
+import (
+ "github.com/stretchr/testify/mock"
+)
+
+type mockfile struct {
+ mock.Mock
+ fd uintptr
+ name string
+}
+
+func (m *mockfile) Fd() uintptr {
+ return m.fd
+}
+
+func (m *mockfile) Name() string {
+ return m.name
+}
+
+func (m *mockfile) ReadAt(b []byte, off int64) (n int, err error) {
+ args := m.Called(b, off)
+ return args.Int(0), args.Error(1)
+}
+
+func (m *mockfile) WriteAt(b []byte, off int64) (n int, err error) {
+ args := m.Called(b, off)
+ return args.Int(0), args.Error(1)
+}