Skip to content

Commit e7889f9

Browse files
authored
Merge pull request #169 from pjbgf/cap
embedfs: Align Capabilities with supported features
2 parents 80673c4 + c72229a commit e7889f9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

embedfs/embed.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ func (fs *Embed) ReadDir(path string) ([]fs.DirEntry, error) {
9292
return fs.underlying.ReadDir(path)
9393
}
9494

95+
func (fs *Embed) Capabilities() billy.Capability {
96+
return billy.ReadCapability | billy.SeekCapability
97+
}
98+
9599
// Chroot is not supported.
96100
//
97101
// Calls will always return billy.ErrNotSupported.

embedfs/embed_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,13 @@ func TestJoin(t *testing.T) {
354354
})
355355
}
356356
}
357+
358+
func TestCapabilities(t *testing.T) {
359+
fs := New(&testdataDir)
360+
_, ok := fs.(billy.Capable)
361+
assert.True(t, ok)
362+
363+
want := billy.ReadCapability | billy.SeekCapability
364+
got := billy.Capabilities(fs)
365+
assert.Equal(t, want, got)
366+
}

0 commit comments

Comments
 (0)