diff options
author | Eric Wong <e@80x24.org> | 2019-09-02 04:51:31 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-09-09 01:59:23 +0000 |
commit | 7f3f4923ec711ec97a1204ec2c080e219f50ff3b (patch) | |
tree | 0f15ed7624754eda339fc31d8889ba1407e0241c /t/nntpd.t | |
parent | 16d96f80e55d3f40338101ee8641e03f3b4f2d64 (diff) | |
download | public-inbox-7f3f4923ec711ec97a1204ec2c080e219f50ff3b.tar.gz |
IO::Socket::INET->new is rather verbose with the options hash, extract it into a standalone sub
Diffstat (limited to 't/nntpd.t')
-rw-r--r-- | t/nntpd.t | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -119,12 +119,6 @@ EOF is($n->code, 580, 'got 580 code on server w/o TLS'); }; - %opts = ( - PeerAddr => $host_port, - Proto => 'tcp', - Type => SOCK_STREAM, - Timeout => 1, - ); my $mid = '<nntp@example.com>'; my %xhdr = ( 'message-id' => $mid, @@ -137,22 +131,20 @@ EOF 'references' => '<reftabsqueezed>', ); - my $s = IO::Socket::INET->new(%opts); + my $s = tcp_connect($sock); sysread($s, my $buf, 4096); is($buf, "201 " . hostname . " ready - post via email\r\n", 'got greeting'); - $s->autoflush(1); ok(syswrite($s, " \r\n"), 'wrote spaces'); ok(syswrite($s, "\r\n"), 'wrote nothing'); syswrite($s, "NEWGROUPS\t19990424 000000 \033GMT\007\r\n"); is(0, sysread($s, $buf, 4096), 'GOT EOF on cntrl'); - $s = IO::Socket::INET->new(%opts); + $s = tcp_connect($sock); sysread($s, $buf, 4096); is($buf, "201 " . hostname . " ready - post via email\r\n", 'got greeting'); - $s->autoflush(1); syswrite($s, "CAPABILITIES\r\n"); $buf = read_til_dot($s); |