Skip to content

Commit 758f406

Browse files
committed
Tests: made http_content() exportable.
1 parent 02be350 commit 758f406

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

http_host.t

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use Test::More;
1515
BEGIN { use FindBin; chdir($FindBin::Bin); }
1616

1717
use lib 'lib';
18-
use Test::Nginx;
18+
use Test::Nginx qw/ :DEFAULT http_content /;
1919

2020
###############################################################################
2121

@@ -185,7 +185,7 @@ GET / HTTP/1.0
185185
Host: $host
186186
187187
EOF
188-
return ($all ? $r : Test::Nginx::http_content($r));
188+
return ($all ? $r : http_content($r));
189189
}
190190

191191
sub http_absolute_path {
@@ -195,7 +195,7 @@ GET http://$host/ HTTP/1.0
195195
Host: localhost
196196
197197
EOF
198-
return ($all ? $r : Test::Nginx::http_content($r));
198+
return ($all ? $r : http_content($r));
199199
}
200200

201201
###############################################################################

lib/Test/Nginx.pm

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ use strict;
1212
use base qw/ Exporter /;
1313

1414
our @EXPORT = qw/ log_in log_out http http_get http_head port /;
15-
our @EXPORT_OK = qw/ http_gzip_request http_gzip_like http_start http_end /;
15+
our @EXPORT_OK = qw/
16+
http_gzip_request http_gzip_like http_start http_end http_content
17+
/;
1618
our %EXPORT_TAGS = (
1719
gzip => [ qw/ http_gzip_request http_gzip_like / ]
1820
);

mp4.t

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use Test::More;
1616
BEGIN { use FindBin; chdir($FindBin::Bin); }
1717

1818
use lib 'lib';
19-
use Test::Nginx;
19+
use Test::Nginx qw/ :DEFAULT http_content /;
2020

2121
###############################################################################
2222

@@ -144,7 +144,7 @@ sub durations {
144144
$uri .= "?end=$end";
145145
}
146146

147-
$t->write_file('frag.mp4', Test::Nginx::http_content(http_get($uri)));
147+
$t->write_file('frag.mp4', http_content(http_get($uri)));
148148

149149
my $r = `ffprobe -show_streams $path 2>/dev/null`;
150150
Test::Nginx::log_core('||', $r);

proxy_unfinished.t

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use Socket qw/ CRLF /;
2424
BEGIN { use FindBin; chdir($FindBin::Bin); }
2525

2626
use lib 'lib';
27-
use Test::Nginx;
27+
use Test::Nginx qw/ :DEFAULT http_content /;
2828

2929
###############################################################################
3030

@@ -144,7 +144,7 @@ chmod(0000, $t->testdir() . '/proxy_temp');
144144
my $r = http_get_11('/proxy/big.html', sleep => 0.5);
145145

146146
SKIP: {
147-
skip 'finished', 1 if length(Test::Nginx::http_content($r)) == 1024 * 1024 + 8;
147+
skip 'finished', 1 if length(http_content($r)) == 1024 * 1024 + 8;
148148

149149
like($r, qr/X(?!.*\x0d\x0a?0\x0d\x0a?)/s, 'no proxy temp');
150150

sub_filter_slice.t

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use Test::More;
1717
BEGIN { use FindBin; chdir($FindBin::Bin); }
1818

1919
use lib 'lib';
20-
use Test::Nginx;
20+
use Test::Nginx qw/ :DEFAULT http_content /;
2121

2222
###############################################################################
2323

@@ -83,7 +83,7 @@ local $TODO = 'not yet';
8383

8484
$r = get('/t', 'Range: bytes=3-4');
8585
like($r, qr/ 206 /, 'range request - 206 partial reply');
86-
is(Test::Nginx::http_content($r), '34', 'range request - correct content');
86+
is(http_content($r), '34', 'range request - correct content');
8787

8888
}
8989

0 commit comments

Comments
 (0)