Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Do actual testing. Props to timo for finding out how.
  • Loading branch information
arnsholt committed Feb 27, 2013
1 parent 330be5a commit 97a9c6d
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions t/00-basic.t
Expand Up @@ -3,9 +3,33 @@ use v6;
use Test;

use Net::ZMQ;
use Net::ZMQ::Constants;

plan 1;
plan 10;

ok 1, 'alive';
my Net::ZMQ::Context $ctx .= new();
pass 'creating context';

my Net::ZMQ::Socket $alice .= new($ctx, ZMQ_PAIR); #Net::ZMQ::Constants::ZMQ_PAIR);
pass 'creating socket - imported constant';
my Net::ZMQ::Socket $bob .= new($ctx, Net::ZMQ::Constants::ZMQ_PAIR); #Net::ZMQ::Constants::ZMQ_PAIR);
pass 'creating socket - namespaced constant';

$alice.bind('inproc://alice');
pass 'binding to inproc address';
$bob.connect('inproc://alice');
pass 'connecting to inproc address';

$alice.send('foo', 0);
is $bob.receive(0).data(), 'foo', 'sending and receiving simple message';


$alice.send('quux', ZMQ_SNDMORE);
pass 'sending SNDMORE message';
$alice.send('barf', 0);

is $bob.receive(0).data(), 'quux', 'receiving first part of two-part message';
is $bob.getopt(ZMQ_RCVMORE), 1, 'getting RCVMORE flag';
is $bob.receive(0).data(), 'barf', 'receiving second part of two-parter';

# vim: ft=perl6

0 comments on commit 97a9c6d

Please sign in to comment.