Skip to content

Commit 72ab057

Browse files
committed
Factor out a magic number to a constant
1 parent 440672c commit 72ab057

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

S16-io/watch.t

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ plan 1;
99
#?DOES 1
1010
{
1111
# Test if file change events are not lost.
12+
my constant RUNS = 10;
1213
my $watch-file = $*SPEC.catfile( $*TMPDIR, "watchme" );
1314
my $fh = $watch-file.IO.open: :w, :0out-buffer;
1415
my $start-writing = Promise.new;
1516
my $start-vow = $start-writing.vow;
16-
my @proceed = Promise.new xx 10;
17+
my @proceed = Promise.new xx RUNS;
1718
@proceed[0].keep;
1819
start {
1920
await $start-writing;
20-
for ^10 {
21+
for ^RUNS {
2122
await @proceed[$_];
2223
$fh.say: $_;
2324
$fh.flush;
@@ -30,7 +31,7 @@ plan 1;
3031
whenever $watch-file.IO.watch -> $e {
3132
$count++;
3233
@proceed[$count].?keep;
33-
done if $count == 10;
34+
done if $count == RUNS;
3435
}
3536
whenever $timeout {
3637
done;
@@ -39,7 +40,7 @@ plan 1;
3940
}
4041

4142
if $timeout.status ~~ Planned {
42-
is $count, 10, "all watch events received";
43+
is $count, RUNS, "all watch events received";
4344
}
4445
else {
4546
flunk "timed out waiting for file change events";

0 commit comments

Comments
 (0)