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
2642d571
Commit
2642d571
authored
Dec 19, 2016
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
memfs_test: pass on Go 1.8 and above, too.
This was broken by golang/go@321c312d8246dec6889f5fe334b6193c320baf0e.
parent
dfa49f55
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
23 deletions
+24
-23
samples/memfs/memfs_go18_test.go
samples/memfs/memfs_go18_test.go
+5
-0
samples/memfs/memfs_others_test.go
samples/memfs/memfs_others_test.go
+5
-0
samples/memfs/memfs_test.go
samples/memfs/memfs_test.go
+14
-23
No files found.
samples/memfs/memfs_go18_test.go
0 → 100644
View file @
2642d571
// +build go1.8
package
memfs_test
const
atLeastGo18
=
true
samples/memfs/memfs_others_test.go
0 → 100644
View file @
2642d571
// +build !go1.8
package
memfs_test
const
atLeastGo18
=
false
samples/memfs/memfs_test.go
View file @
2642d571
...
...
@@ -1567,30 +1567,21 @@ func (t *MemFSTest) RenameOverExistingDirectory() {
err
=
os
.
Mkdir
(
newPath
,
0600
)
AssertEq
(
nil
,
err
)
// Renaming over the non-empty
one
shouldn't work.
// Renaming over the non-empty
directory
shouldn't work.
err
=
os
.
Rename
(
newPath
,
oldPath
)
ExpectThat
(
err
,
Error
(
HasSubstr
(
"not empty
"
)))
ExpectThat
(
err
,
Error
(
MatchesRegexp
(
"not empty|file exists
"
)))
// 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
]
// As of Go 1.8 this shouldn't work the other way around either (see
// https://github.com/golang/go/commit/321c312).
if
atLeastGo18
{
err
=
os
.
Rename
(
oldPath
,
newPath
)
ExpectThat
(
err
,
Error
(
HasSubstr
(
"file exists"
)))
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
())
// Both should still be present in the parent listing.
entries
,
err
:=
fusetesting
.
ReadDirPicky
(
t
.
Dir
)
AssertEq
(
nil
,
err
)
ExpectEq
(
2
,
len
(
entries
))
}
}
func
(
t
*
MemFSTest
)
RenameOverExisting_WrongType
()
{
...
...
@@ -1605,9 +1596,9 @@ func (t *MemFSTest) RenameOverExisting_WrongType() {
err
=
os
.
Mkdir
(
dirPath
,
0700
)
AssertEq
(
nil
,
err
)
// Renaming
one
over the other shouldn't work.
// Renaming
either
over the other shouldn't work.
err
=
os
.
Rename
(
filePath
,
dirPath
)
ExpectThat
(
err
,
Error
(
HasSubstr
(
"is a directory
"
)))
ExpectThat
(
err
,
Error
(
MatchesRegexp
(
"is a directory|file exists
"
)))
err
=
os
.
Rename
(
dirPath
,
filePath
)
ExpectThat
(
err
,
Error
(
HasSubstr
(
"not a 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