Skip to content

Commit

Permalink
Test concurrentyl using dir() works
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Oct 11, 2017
1 parent 6e6045b commit 807ed81
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion S32-io/dir.t
Expand Up @@ -3,7 +3,7 @@ use lib 't/spec/packages';
use Test;
use Test::Util;

plan 16;
plan 17;

# L<S32::IO/Functions/"=item dir">

Expand Down Expand Up @@ -69,4 +69,23 @@ subtest "dir-created IO::Paths' absoluteness controlled by invocant" => {
cmp-ok +@files, '==', +@files.grep({ .is-absolute}), 'absolute invocant';
}

with make-temp-dir() -> $dir {
$dir.add("$_$_$_").spurt("") for "a".."z";

## Read the folder from multiple threads, and sanity-check each IO::Path.
## The sanity check should never fail, but at some point it does.
is_run q:to//,
await do for ^20 {
start {
for \qq[$dir.perl()].dir -> $path {
die "FAILED!" if $path.absolute ne $path.Str
}
}
}
print 'pass';
{:out<pass>, :err(''), :0status},
'dir() does not produce wrong results under concurrent load';
}

# vim: ft=perl6

0 comments on commit 807ed81

Please sign in to comment.