# HG changeset patch # User Maxim Dounin # Date 1231695239 -10800 # Node ID b5b4271554b01ad35a80f0cdaad3466869c87dff # Parent 573c8293ac381a2c9e09b6d4870bbc08c34a70ec Test: use TODO for smtp pipelining tests. diff --git a/lib/Test/Nginx/SMTP.pm b/lib/Test/Nginx/SMTP.pm --- a/lib/Test/Nginx/SMTP.pm +++ b/lib/Test/Nginx/SMTP.pm @@ -59,12 +59,12 @@ sub read { sub check { my ($self, $regex, $name) = @_; - Test::More::like($self->read(), $regex, $name); + Test::More->builder->like($self->read(), $regex, $name); } sub ok { my $self = shift; - $self->check(qr/^2\d\d /, @_); + Test::More->builder->like($self->read(), qr/^2\d\d /, @_); } ############################################################################### diff --git a/smtp.t b/smtp.t --- a/smtp.t +++ b/smtp.t @@ -26,7 +26,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; my $t = Test::Nginx->new() - ->has('mail')->plan(26) + ->has('mail')->plan(20) ->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon) ->write_file_expand('nginx.conf', <<'EOF')->run(); @@ -113,11 +113,13 @@ my $s = Test::Nginx::SMTP->new(); # Try auth plain with pipelining -$s = Test::Nginx::SMTP->new(); -$s->check(qr/^220 /, "greeting"); +TODO: { +local $TODO = 'pipelining not in official nginx'; +$s = Test::Nginx::SMTP->new(); +$s->read(); $s->send('EHLO example.com'); -$s->check(qr/^250 /, "ehlo"); +$s->read(); $s->send('INVALID COMMAND WITH ARGUMENTS' . CRLF . 'RSET'); @@ -136,13 +138,14 @@ my $s = Test::Nginx::SMTP->new(); $s->read(); $s->ok('mail from after pipelined auth'); +} + # Try auth none $s = Test::Nginx::SMTP->new(); -$s->check(qr/^220 /, "greeting"); - +$s->read(); $s->send('EHLO example.com'); -$s->check(qr/^250 /, "ehlo"); +$s->read(); $s->send('MAIL FROM: SIZE=100'); $s->ok('auth none - mail from'); @@ -156,10 +159,9 @@ my $s = Test::Nginx::SMTP->new(); # Auth none with pipelining $s = Test::Nginx::SMTP->new(); -$s->check(qr/^220 /, "greeting"); - +$s->read(); $s->send('EHLO example.com'); -$s->check(qr/^250 /, "ehlo"); +$s->read(); $s->send('MAIL FROM: SIZE=100' . CRLF . 'RCPT TO:' . CRLF @@ -167,16 +169,20 @@ my $s = Test::Nginx::SMTP->new(); $s->ok('pipelined mail from'); +TODO: { +local $TODO = 'pipelining not in official nginx'; + $s->ok('pipelined rcpt to'); $s->ok('pipelined rset'); +} + # Connection must stay even if error returned to rcpt to command $s = Test::Nginx::SMTP->new(); -$s->read(); # skip greeting - +$s->read(); $s->send('EHLO example.com'); -$s->read(); # skip ehlo reply +$s->read(); $s->send('MAIL FROM: SIZE=100'); $s->read(); # skip mail from reply