Skip to content

Commit

Permalink
Tests listening on port 0 returns usable tap with whenever
Browse files Browse the repository at this point in the history
This tests for regressions of:
  rakudo/rakudo#2411
  • Loading branch information
jmaslak committed Nov 5, 2018
1 parent d694464 commit 6113860
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion S32-io/IO-Socket-Async.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 38;
plan 40;

my $hostname = 'localhost';
my $port = 5000;
Expand Down Expand Up @@ -292,3 +292,15 @@ for '127.0.0.1', '::1' -> $host {
is @first-got.join(""), "hello first", "first server socket got the right message";
is @second-got.join(""), "hello second", "second server socket got the right message";
}

# Rakudo Issue #2411
{
my $listen-socket = IO::Socket::Async.listen("127.0.0.1", 0);
react {
my $listen-tap = do whenever $listen-socket -> $socket { … }
lives-ok { await $listen-tap.socket-port }, "can await on socket-port";
ok $listen-tap.socket-port.result > 0, "port looks reasonable";
done;
}
}

0 comments on commit 6113860

Please sign in to comment.