浏览代码

filesystem: Added IsMounted() unit tests

Andrea Luzzardi 12 年之前
父节点
当前提交
d8bc912238
共有 1 个文件被更改,包括 20 次插入0 次删除
  1. 20 0
      filesystem_test.go

+ 20 - 0
filesystem_test.go

@@ -27,21 +27,41 @@ func TestFilesystem(t *testing.T) {
 		t.Errorf("Umount succeeded even though the filesystem was not mounted")
 	}
 
+	if filesystem.IsMounted() {
+		t.Fatal("Filesystem should not be mounted")
+	}
+
 	if err := filesystem.Mount(); err != nil {
 		t.Fatal(err)
 	}
 
+	if !filesystem.IsMounted() {
+		t.Fatal("Filesystem should be mounted")
+	}
+
 	if err := filesystem.Mount(); err == nil {
 		t.Errorf("Double mount succeeded")
 	}
 
+	if !filesystem.IsMounted() {
+		t.Fatal("Filesystem should be mounted")
+	}
+
 	if err := filesystem.Umount(); err != nil {
 		t.Fatal(err)
 	}
 
+	if filesystem.IsMounted() {
+		t.Fatal("Filesystem should not be mounted")
+	}
+
 	if err := filesystem.Umount(); err == nil {
 		t.Errorf("Umount succeeded even though the filesystem was already umounted")
 	}
+
+	if filesystem.IsMounted() {
+		t.Fatal("Filesystem should not be mounted")
+	}
 }
 
 func TestFilesystemMultiLayer(t *testing.T) {