From 4941f43f0fcac72ba663bc96abef19fe913becd4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 14 Nov 2019 06:41:11 +0000 Subject: t/common: inline stream_to_string into t/feed.t We only use it in one place and have favored test_psgi in newer tests, so move it out-of-the-way to reduce startup overhead of other *.t files. --- t/common.perl | 11 ----------- t/feed.t | 9 ++++++++- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 't') diff --git a/t/common.perl b/t/common.perl index ccc7be46..053a935a 100644 --- a/t/common.perl +++ b/t/common.perl @@ -7,17 +7,6 @@ use strict; use warnings; use IO::Socket::INET; -sub stream_to_string { - my ($res) = @_; - my $body = $res->[2]; - my $str = ''; - while (defined(my $chunk = $body->getline)) { - $str .= $chunk; - } - $body->close; - $str; -} - sub tcp_server () { IO::Socket::INET->new( LocalAddr => '127.0.0.1', diff --git a/t/feed.t b/t/feed.t index eb1f35fb..93da3717 100644 --- a/t/feed.t +++ b/t/feed.t @@ -14,7 +14,14 @@ my $have_xml_feed = eval { require XML::Feed; 1 }; require './t/common.perl'; sub string_feed { - stream_to_string(PublicInbox::Feed::generate($_[0])); + my $res = PublicInbox::Feed::generate($_[0]); + my $body = $res->[2]; + my $str = ''; + while (defined(my $chunk = $body->getline)) { + $str .= $chunk; + } + $body->close; + $str; } my $tmpdir = tempdir('pi-feed-XXXXXX', TMPDIR => 1, CLEANUP => 1); -- cgit v1.2.3-24-ge0c7