From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id BA3431F5A2 for ; Thu, 14 Nov 2019 06:41:14 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/4] t/common: inline stream_to_string into t/feed.t Date: Thu, 14 Nov 2019 06:41:11 +0000 Message-Id: <20191114064114.9763-2-e@80x24.org> In-Reply-To: <20191114064114.9763-1-e@80x24.org> References: <20191114064114.9763-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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(-) 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);