File: 80extended%2Basync.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 (36 lines) | stat: -rw-r--r-- 773 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;
BEGIN { $] >= 5.026000 or plan skip_all => "No parse_subsignature()"; }

use Test2::Require::Module 'Future::AsyncAwait' => '0.66';
use Test2::Require::Module 'Sublike::Extended' => '0.29';

use feature 'signatures';
no warnings 'experimental';

use Future::AsyncAwait;
use Sublike::Extended;

# async extended sub
{
   async extended sub f1 (:$x, :$y) { return "x=$x y=$y" }

   is( await f1( x => "first", y => "second" ), "x=first y=second",
      'async extended sub' );
}

# async sub + S:E 0.29
{
   use Sublike::Extended 'sub';

   async sub f2 (:$x, :$y) { return "x=$x y=$y" }

   is( await f2( x => "third", y => "fourth" ), "x=third y=fourth",
      'async sub with extended keyword' );
}

done_testing;