aboutsummaryrefslogtreecommitdiffstats
path: root/utils/fs/test/fs_suite.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-11-20 12:25:10 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-11-20 12:25:10 +0100
commit32c610c0000b7af5c85e69306853636a77f2168b (patch)
tree04f552cc2776fda80a938c9e1a69a5f8a403e6f6 /utils/fs/test/fs_suite.go
parent2e60c554dbe56eed3e9a503d03fed01b459d029a (diff)
downloadgo-git-32c610c0000b7af5c85e69306853636a77f2168b.tar.gz
utils: fs, memory fix read offset
Diffstat (limited to 'utils/fs/test/fs_suite.go')
-rw-r--r--utils/fs/test/fs_suite.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/fs/test/fs_suite.go b/utils/fs/test/fs_suite.go
index 01d6112..91b2be5 100644
--- a/utils/fs/test/fs_suite.go
+++ b/utils/fs/test/fs_suite.go
@@ -8,6 +8,8 @@ import (
"strings"
"testing"
+ "bytes"
+
. "gopkg.in/check.v1"
. "gopkg.in/src-d/go-git.v4/utils/fs"
)
@@ -455,3 +457,23 @@ func (s *FilesystemSuite) TestReadAtOnReadOnly(c *C) {
c.Assert(string(b), Equals, "cde")
c.Assert(f.Close(), IsNil)
}
+
+func (s *FilesystemSuite) TestReadWriteLargeFile(c *C) {
+ f, err := s.Fs.Create("foo")
+ c.Assert(err, IsNil)
+
+ size := 1 << 20
+
+ n, err := f.Write(bytes.Repeat([]byte("F"), size))
+ c.Assert(err, IsNil)
+ c.Assert(n, Equals, size)
+
+ err = f.Close()
+ c.Assert(err, IsNil)
+
+ f, err = s.Fs.Open("foo")
+ c.Assert(err, IsNil)
+ b, err := ioutil.ReadAll(f)
+ c.Assert(err, IsNil)
+ c.Assert(len(b), Equals, size)
+}