-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
osfs: fix js implementation based on menfs
- Loading branch information
Showing
4 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// +build js | ||
|
||
package osfs | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/go-git/go-billy/v5" | ||
"github.com/go-git/go-billy/v5/test" | ||
|
||
. "gopkg.in/check.v1" | ||
) | ||
|
||
func Test(t *testing.T) { TestingT(t) } | ||
|
||
type OSSuite struct { | ||
test.FilesystemSuite | ||
path string | ||
tempCounter int | ||
} | ||
|
||
var _ = Suite(&OSSuite{}) | ||
|
||
func (s *OSSuite) SetUpTest(c *C) { | ||
s.tempCounter++ | ||
s.path = fmt.Sprintf("test_%d", s.tempCounter) | ||
s.FilesystemSuite = test.NewFilesystemSuite(New(s.path)) | ||
} | ||
|
||
func (s *OSSuite) TestOpenDoesNotCreateDir(c *C) { | ||
_, err := s.FS.Open("dir/non-existent") | ||
c.Assert(err, NotNil) | ||
|
||
_, err = s.FS.Stat(filepath.Join(s.path, "dir")) | ||
c.Assert(os.IsNotExist(err), Equals, true) | ||
} | ||
|
||
func (s *OSSuite) TestCapabilities(c *C) { | ||
_, ok := s.FS.(billy.Capable) | ||
c.Assert(ok, Equals, true) | ||
|
||
caps := billy.Capabilities(s.FS) | ||
c.Assert(caps, Equals, billy.DefaultCapabilities&^billy.LockCapability) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build plan9 | ||
|
||
package osfs | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !js | ||
|
||
package osfs | ||
|
||
import ( | ||
|