-
-
Notifications
You must be signed in to change notification settings - Fork 888
/
backend_windows_test.go
58 lines (48 loc) · 1.06 KB
/
backend_windows_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//go:build windows
// +build windows
package fsnotify
import (
"fmt"
"path/filepath"
"strings"
"testing"
)
func TestRemoveState(t *testing.T) {
// TODO: the Windows backend is too confusing; needs some serious attention.
return
var (
tmp = t.TempDir()
dir = filepath.Join(tmp, "dir")
file = filepath.Join(dir, "file")
)
mkdir(t, dir)
touch(t, file)
w := newWatcher(t, tmp)
addWatch(t, w, tmp)
addWatch(t, w, file)
check := func(want int) {
t.Helper()
if len(w.watches) != want {
var d []string
for k, v := range w.watches {
d = append(d, fmt.Sprintf("%#v = %#v", k, v))
}
t.Errorf("unexpected number of entries in w.watches (have %d, want %d):\n%v",
len(w.watches), want, strings.Join(d, "\n"))
}
}
check(2)
if err := w.Remove(file); err != nil {
t.Fatal(err)
}
check(1)
if err := w.Remove(tmp); err != nil {
t.Fatal(err)
}
check(0)
}
// TODO: write test which makes sure the buffer size is set correctly.
func TestWindowsWithBufferSize(t *testing.T) {
w := newWatcher(t, t.TempDir())
fmt.Printf("%#v\n", w)
}