diff options
author | Pierre Guilleminot <pierre.guilleminot@gmail.com> | 2016-11-07 10:52:34 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-11-07 10:52:34 +0100 |
commit | 1b2f95c971a2492f012db76bd49a948c2691c9bd (patch) | |
tree | 6102ba115180d87c14efa73b010491ec6f554ad5 /utils/fs/os/os_test.go | |
parent | 1da0de4423bcba9ff98c53f15cbf9cb8f11ebe27 (diff) | |
download | go-git-1b2f95c971a2492f012db76bd49a948c2691c9bd.tar.gz |
utils/fs: Fix O_CREATE flag check in OpenFile (#116)
* utils/fs: Fix O_CREATE flag check in OpenFile
* utils/fs/os: test that Open does not create dirs.
Diffstat (limited to 'utils/fs/os/os_test.go')
-rw-r--r-- | utils/fs/os/os_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/utils/fs/os/os_test.go b/utils/fs/os/os_test.go index 756e284..2bb9391 100644 --- a/utils/fs/os/os_test.go +++ b/utils/fs/os/os_test.go @@ -3,6 +3,7 @@ package os_test import ( "io/ioutil" stdos "os" + "path/filepath" "testing" . "gopkg.in/check.v1" @@ -27,3 +28,10 @@ func (s *OSSuite) TearDownTest(c *C) { err := stdos.RemoveAll(s.path) c.Assert(err, IsNil) } + +func (s *OSSuite) TestOpenDoesNotCreateDir(c *C) { + _, err := s.Fs.Open("dir/non-existant") + c.Assert(err, NotNil) + _, err = stdos.Stat(filepath.Join(s.path, "dir")) + c.Assert(stdos.IsNotExist(err), Equals, true) +} |