Skip to content

Commit 45b3d23

Browse files
committed
mount: adding missing Join method
1 parent a7f984e commit 45b3d23

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

helper/mount/mount.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ func (h *Mount) Symlink(target, link string) error {
141141
return fs.Symlink(target, fullpath)
142142
}
143143

144+
func (h *Mount) Join(elem ...string) string {
145+
return h.underlying.Join(elem...)
146+
}
147+
144148
func (h *Mount) Readlink(link string) (string, error) {
145149
fs, fullpath, err := h.getSymlinkAndPath(link)
146150
if err != nil {

helper/mount/mount_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ func (s *MountSuite) TestReadDir(c *C) {
215215
c.Assert(s.Source.ReadDirArgs, HasLen, 0)
216216
}
217217

218+
func (s *MountSuite) TestJoin(c *C) {
219+
s.Helper.Join("foo", "bar")
220+
221+
c.Assert(s.Underlying.JoinArgs, HasLen, 1)
222+
c.Assert(s.Underlying.JoinArgs[0], DeepEquals, []string{"foo", "bar"})
223+
c.Assert(s.Source.JoinArgs, HasLen, 0)
224+
}
225+
218226
func (s *MountSuite) TestReadDirInMount(c *C) {
219227
_, err := s.Helper.ReadDir("foo/bar/qux")
220228
c.Assert(err, IsNil)

test/mock.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type BasicMock struct {
1616
StatArgs []string
1717
RenameArgs [][2]string
1818
RemoveArgs []string
19+
JoinArgs [][]string
1920
}
2021

2122
func (fs *BasicMock) Create(filename string) (billy.File, error) {
@@ -49,6 +50,7 @@ func (fs *BasicMock) Remove(filename string) error {
4950
}
5051

5152
func (fs *BasicMock) Join(elem ...string) string {
53+
fs.JoinArgs = append(fs.JoinArgs, elem)
5254
return path.Join(elem...)
5355
}
5456

0 commit comments

Comments
 (0)