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
60383de7
Commit
60383de7
authored
Jun 25, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MemFSTest.RenameWithinDir_File
parent
044aa10a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
samples/memfs/memfs_test.go
samples/memfs/memfs_test.go
+42
-1
No files found.
samples/memfs/memfs_test.go
View file @
60383de7
...
...
@@ -1273,7 +1273,48 @@ func (t *MemFSTest) SymlinkInParallel() {
}
func
(
t
*
MemFSTest
)
RenameWithinDir_File
()
{
AssertTrue
(
false
,
"TODO"
)
var
err
error
// Create a parent directory.
parentPath
:=
path
.
Join
(
t
.
Dir
,
"parent"
)
err
=
os
.
Mkdir
(
parentPath
,
0700
)
AssertEq
(
nil
,
err
)
// And a file within it.
oldPath
:=
path
.
Join
(
parentPath
,
"foo"
)
err
=
ioutil
.
WriteFile
(
oldPath
,
[]
byte
(
"taco"
),
0644
)
AssertEq
(
nil
,
err
)
// Rename it.
newPath
:=
path
.
Join
(
parentPath
,
"bar"
)
err
=
os
.
Rename
(
oldPath
,
newPath
)
AssertEq
(
nil
,
err
)
// The old name shouldn't work.
_
,
err
=
os
.
Stat
(
oldPath
)
ExpectTrue
(
os
.
IsNotExist
(
err
),
"err: %v"
,
err
)
_
,
err
=
ioutil
.
ReadFile
(
oldPath
)
ExpectTrue
(
os
.
IsNotExist
(
err
),
"err: %v"
,
err
)
// The new name should.
fi
,
err
:=
os
.
Stat
(
newPath
)
AssertEq
(
nil
,
err
)
ExpectEq
(
len
(
"taco"
),
fi
.
Size
())
contents
,
err
:=
ioutil
.
ReadFile
(
newPath
)
AssertEq
(
nil
,
err
)
ExpectEq
(
"taco"
,
string
(
contents
))
// There should only be the new entry in the directory.
entries
,
err
:=
fusetesting
.
ReadDirPicky
(
parentPath
)
AssertEq
(
nil
,
err
)
AssertEq
(
1
,
len
(
entries
))
ExpectEq
(
path
.
Base
(
newPath
),
entries
[
0
]
.
Name
())
}
func
(
t
*
MemFSTest
)
RenameWithinDir_Directory
()
{
...
...
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