Skip to content

Commit

Permalink
Add test to see what happens if you watch a symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Aug 10, 2022
1 parent 123e4e3 commit 5547ba6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions fsnotify_test.go
Expand Up @@ -152,6 +152,30 @@ func TestWatch(t *testing.T) {
}, `
write /file
`},

{"watch a symlink to a file", func(t *testing.T, w *Watcher, tmp string) {
file := filepath.Join(tmp, "file")
link := filepath.Join(tmp, "link")
touch(t, file)
symlink(t, file, link)
addWatch(t, w, link)

cat(t, "hello", file)
}, `
write /link
`},

{"watch a symlink to a dir", func(t *testing.T, w *Watcher, tmp string) {
dir := filepath.Join(tmp, "dir")
link := filepath.Join(tmp, "link")
mkdir(t, dir)
symlink(t, dir, link)
addWatch(t, w, link)

touch(t, dir, "file")
}, `
create /link/file
`},
}

for _, tt := range tests {
Expand Down

0 comments on commit 5547ba6

Please sign in to comment.