rename disk.OpenFile to Open which will do os.Open (which will be read-only). disk.OpenFile will do os.OpenFile (which can be rw, append)

This commit is contained in:
Krishna Srinivas
2015-08-02 17:34:29 +05:30
parent ae685f0548
commit ee4432bc40
4 changed files with 24 additions and 9 deletions

View File

@@ -65,19 +65,19 @@ func (s *MyDiskSuite) TestDiskCreateFile(c *C) {
// close renames the file
f.Close()
// Openfile should be a success
_, err = s.disk.OpenFile("hello1")
// Open should be a success
_, err = s.disk.Open("hello1")
c.Assert(err, IsNil)
}
func (s *MyDiskSuite) TestDiskOpenFile(c *C) {
func (s *MyDiskSuite) TestDiskOpen(c *C) {
f1, err := s.disk.CreateFile("hello2")
c.Assert(err, IsNil)
c.Assert(f1.Name(), Not(Equals), filepath.Join(s.path, "hello2"))
// close renames the file
f1.Close()
f2, err := s.disk.OpenFile("hello2")
f2, err := s.disk.Open("hello2")
c.Assert(err, IsNil)
c.Assert(f2.Name(), Equals, filepath.Join(s.path, "hello2"))
defer f2.Close()