Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
test(fsnode): modify test
Browse files Browse the repository at this point in the history
  • Loading branch information
overbool committed Oct 20, 2018
1 parent c9235a3 commit 815d4af
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions mfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1183,38 +1183,29 @@ func TestTruncateAndWrite(t *testing.T) {
}
}

func TestIsDir(t *testing.T) {
func TestHelper(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ds, rt := setupRoot(ctx, t)

dir := rt.GetDirectory()

// check for IsDir
nd := dag.NodeWithData(ft.FolderPBData())
di, err := NewDirectory(ctx, "test", nd, dir, ds)
di, err := NewDirectory(ctx, "test", nd, rt.GetDirectory(), ds)
if err != nil {
t.Fatal(err)
}
ret := IsDir(di)
if !ret {
t.Fatal("FSNode type should be dir, but not")
}
}

func TestIsFile(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ds, rt := setupRoot(ctx, t)

dir := rt.GetDirectory()

nd := dag.NodeWithData(ft.FilePBData(nil, 0))
fi, err := NewFile("test", nd, dir, ds)
// check for IsFile
fnd := dag.NodeWithData(ft.FilePBData(nil, 0))
fi, err := NewFile("test", fnd, rt.GetDirectory(), ds)
if err != nil {
t.Fatal(err)
}

ret := IsFile(fi)
ret = IsFile(fi)
if !ret {
t.Fatal("FSNode type should be file, but not")
}
Expand Down

0 comments on commit 815d4af

Please sign in to comment.