# HG changeset patch # User Sergey Kandaurov # Date 1472218102 -10800 # Node ID 4f739c15069e64d9c54dacb2ea5b09d91dd2c722 # Parent 9f576b8bb4c872dd2f89c9bd2c283e95f5696fa1 Tests: stream $protocol tests. diff --git a/stream_variables.t b/stream_variables.t --- a/stream_variables.t +++ b/stream_variables.t @@ -16,7 +16,7 @@ BEGIN { use FindBin; chdir($FindBin::Bin use lib 'lib'; use Test::Nginx; -use Test::Nginx::Stream qw/ stream /; +use Test::Nginx::Stream qw/ stream dgram /; ############################################################################### @@ -66,11 +66,17 @@ stream { listen 127.0.0.1:8085; return $msec!$time_local!$time_iso8601; } + + server { + listen 127.0.0.1:8086; + listen 127.0.0.1:%%PORT_8087_UDP%% udp; + return $protocol; + } } EOF -$t->try_run('no stream return')->plan(6); +$t->try_run('no stream return')->plan(8); ############################################################################### @@ -94,4 +100,7 @@ is(unpack("H*", $data), '0' x 31 . '1', $data = stream('127.0.0.1:' . port(8085))->read(); like($data, qr#^\d+.\d+![-+\w/: ]+![-+\dT:]+$#, 'time'); +is(stream('127.0.0.1:' . port(8086))->read(), 'TCP', 'protocol TCP'); +is(dgram('127.0.0.1:' . port(8087))->io('.'), 'UDP', 'protocol UDP'); + ###############################################################################