Skip to content

Commit

Permalink
Test IO::Socket::INET.new: :!listen dispatches right
Browse files Browse the repository at this point in the history
Closes rakudo/rakudo#1738 R#1738
Rakudo fix: rakudo/rakudo#1738
  • Loading branch information
zoffixznet committed Apr 16, 2018
1 parent 555e1f6 commit a25af14
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion S32-io/IO-Socket-INET.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 27;
plan 28;

# test 2 does echo protocol - Internet RFC 862
do-test
Expand Down Expand Up @@ -289,6 +289,23 @@ do-test
}
}

{ # https://github.com/rakudo/rakudo/issues/1738
my $sync := Channel.new;
start {
my $server := IO::Socket::INET.new:
:localhost<localhost>, :0localport, :listen;
$sync.send: $server.localport;
my $client := $server.accept;
$client.print: "Test passed\n";
$client.close;
$server.close;
}
is IO::Socket::INET.new(
:!listen, # <-- testing on purpose with :!listen set
:host<localhost>, :port($sync.receive)
).get, 'Test passed', 'can connect as client when :$listen is set to False';
}

if $*DISTRO.is-win or # test for WSL below
$*KERNEL.name eq "linux" and $*KERNEL.release ~~ /:i <|w>Microsoft<|w>/ {
skip 'Winsock 1 second delay for connection failure RT #130892', 1
Expand Down

0 comments on commit a25af14

Please sign in to comment.