Skip to content

Commit

Permalink
Add test for re-adding a renamed file (#508)
Browse files Browse the repository at this point in the history
Ref: #503
  • Loading branch information
arp242 committed Sep 15, 2022
1 parent 85acde2 commit 89b4cf1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions fsnotify_test.go
Expand Up @@ -492,6 +492,35 @@ func TestWatchRename(t *testing.T) {
rename /file
rename /rename-one
`},

{"re-add renamed file", func(t *testing.T, w *Watcher, tmp string) {
file := filepath.Join(tmp, "file")
rename := filepath.Join(tmp, "rename")
touch(t, file)

addWatch(t, w, file)

mv(t, file, rename)
touch(t, file)
addWatch(t, w, file)
cat(t, "hello", rename)
cat(t, "hello", file)
}, `
rename /file # mv file rename
write /rename # cat hello >rename
write /file # cat hello >file
# TODO: wrong.
linux:
RENAME "/file"
WRITE "/file"
WRITE ""
# TODO: wrong.
kqueue:
RENAME "/file"
WRITE "/file"
`},
}

for _, tt := range tests {
Expand Down

0 comments on commit 89b4cf1

Please sign in to comment.