File: await_wait__ioasync.t

package info (click to toggle)
libpromise-xs-perl 0.20-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 908 kB
  • sloc: perl: 1,097; ansic: 355; makefile: 3
file content (35 lines) | stat: -rw-r--r-- 549 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
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More;

use Promise::XS;

use Test::FailWarnings -allow_deps => 1;

use FindBin;
use lib "$FindBin::Bin/lib";
use AwaitWait;

my $failed_why;

BEGIN {
    eval 'use IO::Async::Loop; 1' or $failed_why = $@;
}

plan skip_all => "Can’t run test: $failed_why" if $failed_why;

my $loop = IO::Async::Loop->new();

Promise::XS::use_event('IO::Async', $loop);

AwaitWait::test_success(
    sub {
        my $d = shift;
        $loop->later( sub { $d->resolve(42, 34) } );
    },
);

done_testing;