github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/test/simple_nonfuse_test.go (about)

     1  // Copyright 2017 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !fuse
     6  // +build !fuse
     7  
     8  package test
     9  
    10  import "testing"
    11  
    12  // os.Rename doesn't support overriding empty dst dir, so skip this test if
    13  // FUSE engine is used.
    14  func TestRenameDirOverDir(t *testing.T) {
    15  	test(t,
    16  		users("alice"),
    17  		as(alice,
    18  			mkdir("a/b"),
    19  			mkfile("a/c/d", "hello"),
    20  			rename("a/c", "a/b"),
    21  			lsdir("a/", m{"b": "DIR"}),
    22  			lsdir("a/b", m{"d": "FILE"}),
    23  			read("a/b/d", "hello"),
    24  
    25  			// Rename over a non-empty dir should fail
    26  			mkfile("a/c/e", "world"),
    27  			expectError(rename("a/c", "a/b"),
    28  				"Directory b is not empty and can't be removed"),
    29  		),
    30  	)
    31  }