mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-24 13:48:49 +08:00
Added tests for mocked Stat implementation
Signed-off-by: Erik Agsjö <erik.agsjo@gmail.com>
This commit is contained in:
parent
13c3c111d5
commit
5a5f6eb52b
@ -26,6 +26,21 @@ func TestMockFilesystemOpen(t *testing.T) {
|
||||
gobottest.Refute(t, f4.Fd(), f1.Fd())
|
||||
}
|
||||
|
||||
func TestMockFilesystemStat(t *testing.T) {
|
||||
fs := NewMockFilesystem([]string{"foo", "bar/baz"})
|
||||
|
||||
fileStat, err := fs.Stat("foo")
|
||||
gobottest.Assert(t, err, nil)
|
||||
gobottest.Assert(t, fileStat.IsDir(), false)
|
||||
|
||||
dirStat, err := fs.Stat("bar")
|
||||
gobottest.Assert(t, err, nil)
|
||||
gobottest.Assert(t, dirStat.IsDir(), true)
|
||||
|
||||
_, err = fs.Stat("plonk")
|
||||
gobottest.Refute(t, err, nil)
|
||||
}
|
||||
|
||||
func TestMockFilesystemWrite(t *testing.T) {
|
||||
fs := NewMockFilesystem([]string{"bar"})
|
||||
f1 := fs.Files["bar"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user