Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
jacobsa-fuse
Commits
a28c3afd
Commit
a28c3afd
authored
Jun 25, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MemFSTest.RenameOverExistingDirectory
parent
76b311bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
samples/memfs/memfs_test.go
samples/memfs/memfs_test.go
+35
-1
No files found.
samples/memfs/memfs_test.go
View file @
a28c3afd
...
...
@@ -1585,7 +1585,41 @@ func (t *MemFSTest) RenameOverExistingFile() {
}
func
(
t
*
MemFSTest
)
RenameOverExistingDirectory
()
{
AssertTrue
(
false
,
"TODO"
)
var
err
error
// Create two directories, the first non-empty.
oldPath
:=
path
.
Join
(
t
.
Dir
,
"foo"
)
err
=
os
.
MkdirAll
(
path
.
Join
(
oldPath
,
"child"
),
0700
)
AssertEq
(
nil
,
err
)
newPath
:=
path
.
Join
(
t
.
Dir
,
"bar"
)
err
=
os
.
Mkdir
(
newPath
,
0600
)
AssertEq
(
nil
,
err
)
// Renaming over the non-empty one shouldn't work.
err
=
os
.
Rename
(
newPath
,
oldPath
)
ExpectThat
(
err
,
Error
(
HasSubstr
(
"TODO"
)))
// But the other way around should.
err
=
os
.
Rename
(
oldPath
,
newPath
)
AssertEq
(
nil
,
err
)
// Check the parent listing.
entries
,
err
:=
fusetesting
.
ReadDirPicky
(
t
.
Dir
)
AssertEq
(
nil
,
err
)
AssertEq
(
1
,
len
(
entries
))
fi
:=
entries
[
0
]
ExpectEq
(
path
.
Base
(
newPath
),
fi
.
Name
())
ExpectEq
(
os
.
FileMode
(
0700
)
|
os
.
ModeDir
,
fi
.
Mode
())
// And the directory itself.
entries
,
err
=
fusetesting
.
ReadDirPicky
(
newPath
)
AssertEq
(
nil
,
err
)
AssertEq
(
1
,
len
(
entries
))
fi
=
entries
[
0
]
ExpectEq
(
"child"
,
fi
.
Name
())
}
func
(
t
*
MemFSTest
)
RenameOverExisting_WrongType
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment