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
361e9e61
Commit
361e9e61
authored
Jun 25, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MemFSTest.RenameAcrossDirs_File
parent
bde0d1be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
1 deletion
+54
-1
samples/memfs/memfs_test.go
samples/memfs/memfs_test.go
+54
-1
No files found.
samples/memfs/memfs_test.go
View file @
361e9e61
...
...
@@ -1404,7 +1404,60 @@ func (t *MemFSTest) RenameWithinDir_SameName() {
}
func
(
t
*
MemFSTest
)
RenameAcrossDirs_File
()
{
AssertTrue
(
false
,
"TODO"
)
var
err
error
// Create two parent directories.
oldParentPath
:=
path
.
Join
(
t
.
Dir
,
"old"
)
newParentPath
:=
path
.
Join
(
t
.
Dir
,
"new"
)
err
=
os
.
Mkdir
(
oldParentPath
,
0700
)
AssertEq
(
nil
,
err
)
err
=
os
.
Mkdir
(
newParentPath
,
0700
)
AssertEq
(
nil
,
err
)
// And a file within the first.
oldPath
:=
path
.
Join
(
oldParentPath
,
"foo"
)
err
=
ioutil
.
WriteFile
(
oldPath
,
[]
byte
(
"taco"
),
0400
)
AssertEq
(
nil
,
err
)
// Rename it.
newPath
:=
path
.
Join
(
newParentPath
,
"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
())
ExpectEq
(
os
.
FileMode
(
0400
),
fi
.
Mode
())
contents
,
err
:=
ioutil
.
ReadFile
(
newPath
)
AssertEq
(
nil
,
err
)
ExpectEq
(
"taco"
,
string
(
contents
))
// Check the old parent.
entries
,
err
:=
fusetesting
.
ReadDirPicky
(
oldParentPath
)
AssertEq
(
nil
,
err
)
AssertEq
(
0
,
len
(
entries
))
// And the new one.
entries
,
err
=
fusetesting
.
ReadDirPicky
(
newParentPath
)
AssertEq
(
nil
,
err
)
AssertEq
(
1
,
len
(
entries
))
fi
=
entries
[
0
]
ExpectEq
(
path
.
Base
(
newPath
),
fi
.
Name
())
ExpectEq
(
os
.
FileMode
(
0400
),
fi
.
Mode
())
}
func
(
t
*
MemFSTest
)
RenameAcrossDirs_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