From 035636830fa3f224d786bd1b90b8796162bf5124 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Mon, 29 Feb 2016 13:41:38 +1100 Subject: [PATCH] Switch to a test that can pass on OS X, too. It appears osxfuse is happy to mount over a non-empty directory. --- mount_test.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/mount_test.go b/mount_test.go index f7234d5..c27e882 100644 --- a/mount_test.go +++ b/mount_test.go @@ -65,7 +65,7 @@ func TestSuccessfulMount(t *testing.T) { defer fuse.Unmount(mfs.Dir()) } -func TestNonEmptyMountPoint(t *testing.T) { +func TestNonexistentMountPoint(t *testing.T) { ctx := context.Background() // Set up a temporary directory. @@ -76,16 +76,10 @@ func TestNonEmptyMountPoint(t *testing.T) { defer os.RemoveAll(dir) - // Add a file within it. - err = ioutil.WriteFile(path.Join(dir, "foo"), []byte{}, 0600) - if err != nil { - t.Fatalf("ioutil.WriteFile: %v", err) - } - - // Attempt to mount. + // Attempt to mount into a sub-directory that doesn't exist. fs := &minimalFS{} mfs, err := fuse.Mount( - dir, + path.Join(dir, "foo"), fuseutil.NewFileSystemServer(fs), &fuse.MountConfig{}) @@ -95,7 +89,7 @@ func TestNonEmptyMountPoint(t *testing.T) { t.Fatal("fuse.Mount returned nil") } - const want = "not empty" + const want = "no such file" if got := err.Error(); !strings.Contains(got, want) { t.Errorf("Unexpected error: %v", got) }