File: 17snail.t

package info (click to toggle)
libfuture-asyncawait-perl 0.70-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 528 kB
  • sloc: perl: 2,647; ansic: 118; pascal: 34; makefile: 3
file content (43 lines) | stat: -rw-r--r-- 596 bytes parent folder | download
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
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

$^V ge v5.24.0 or
   plan skip_all => "This test requires perl 5.24.0";

use Future;

use Future::AsyncAwait;

# RT130683
{
   my @waitf;

   async sub do_wait
   {
      push @waitf, my $f = Future->new;
      await $f;
   }

   async sub check_args
   {
      await do_wait;
      is( scalar @_, 9, 'Snail still has 9 values in it' )
         or diag( "Snail is: <@_>" );
   }

   async sub run
   {
      my @args = 1 .. 9;
      await check_args @args;
   }

   my $f = run();
   ( shift @waitf )->done;
   $f->get;
}

done_testing;