File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ use v6 ;
2
+
3
+ use Test ;
4
+
5
+ plan 1 ;
6
+
7
+ # GH rakudo/rakudo#3100
8
+ {
9
+ # Test if file change events are not lost.
10
+ my $ watch-file = $ * SPEC . catfile( $ * TMPDIR , " watchme" );
11
+ my $ fh = $ watch-file . IO . open : : w, : 0 out-buffer;
12
+ my $ done-writing = Promise . new ;
13
+ my $ done-vow = $ done-writing . vow;
14
+ start {
15
+ sleep .1 ; # Be overcautious.
16
+ for ^ 10 {
17
+ $ fh . say : time ;
18
+ sleep .01 ;
19
+ }
20
+ $ done-vow . keep (True );
21
+ }
22
+
23
+ my $ count = 0 ;
24
+ my $ timeout = Promise . in(5 );
25
+ react {
26
+ whenever $ watch-file . IO . watch -> $ e {
27
+ $ count ++ ;
28
+ }
29
+ whenever $ done-writing {
30
+ done
31
+ }
32
+ whenever $ timeout {
33
+ done ;
34
+ }
35
+ }
36
+
37
+ if $ timeout . status ~~ Planned {
38
+ is $ count , 10 , " all watch events received" ;
39
+ }
40
+ else {
41
+ flunk " timed out waiting for file change events" ;
42
+ }
43
+
44
+ LEAVE {
45
+ $ fh . close ;
46
+ $ watch-file . IO . unlink ;
47
+ }
48
+ }
Original file line number Diff line number Diff line change @@ -844,6 +844,7 @@ S16-io/say.t
844
844
S16-io/split.t
845
845
S16-io/supply.t
846
846
S16-io/tmpdir.t
847
+ S16-io/watch.t
847
848
S16-io/words.t
848
849
S16-unfiled/rebindstdhandles.t
849
850
S17-channel/basic.t
You can’t perform that action at this time.
0 commit comments