You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,53 @@ get merged *if* there's a decent signal they're correct. Merely "it compiles" it
27
27
not enough, because so much of this relies on runtime behaviour. Either a new
28
28
test should be added, or patches should be tested manually.
29
29
30
+
### Test Scripts
31
+
Support for test scripts akin to ones in [fsnotify](https://github.com/fsnotify/fsnotify)
32
+
have been added.
33
+
34
+
All the scripts are in the `testdata` folder, and test can be ran individually
35
+
using the pattern:
36
+
37
+
```go test -run TestScript/<path to test script file>```
38
+
39
+
Scripts are written using a simple DSL which runs a few available shell commands,
40
+
and also allows setting/unsetting the watcher, as well as verifying the output.
41
+
42
+
Available commands:
43
+
```
44
+
watch path [ops] # Watch the path, reporting events for it. Nothing is
45
+
# watched by default.
46
+
unwatch path # Stop watching the path.
47
+
watchlist n # Assert watchlist length.
48
+
49
+
stop # Stop running the script; for debugging.
50
+
51
+
touch path
52
+
mkdir [-p] dir
53
+
ln -s target link # Only ln -s supported.
54
+
mv src dst
55
+
rm [-r] path
56
+
chmod mode path # Octal only
57
+
sleep time-in-ms
58
+
59
+
cat path # Read path (does nothing with the data; just reads it).
60
+
echo str >>path # Append "str" to "path".
61
+
echo str >path # Truncate "path" and write "str".
62
+
```
63
+
64
+
Output can be verified in the scripts using the events and event flags emitted
65
+
by FSEvents. Assertions are defined in the `Output` section of the test script.
66
+
All the flags in test script assertions are equivalent to the ones defined in
67
+
`wrap.go` with the type EventFlags.
68
+
69
+
The output section format:
70
+
```
71
+
Output:
72
+
# Comment
73
+
EventFlag1|EventFlag2 path # Comment
74
+
```
75
+
76
+
30
77
Really quick FSEvents overview
31
78
==============================
32
79
For those new to FSEvents itself (the Apple technology), here's a really quick
0 commit comments