* [PATCH 1/4] t/common: inline stream_to_string into t/feed.t
2019-11-14 6:41 5% [PATCH 0/4] some minor test updates Eric Wong
@ 2019-11-14 6:41 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-11-14 6:41 UTC (permalink / raw)
To: meta
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);
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] some minor test updates
@ 2019-11-14 6:41 5% Eric Wong
2019-11-14 6:41 7% ` [PATCH 1/4] t/common: inline stream_to_string into t/feed.t Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-11-14 6:41 UTC (permalink / raw)
To: meta
A few minor, low impact improvements to avoid loading
and running redundant code while I'm ironing out some
major test improvements.
Eric Wong (4):
t/common: inline stream_to_string into t/feed.t
t/common: move unix_server to t/httpd-corner.t
t/psgi_mount: require SearchIdx before using
doc: check-man: save the result of successful runs
.gitignore | 1 +
Documentation/include.mk | 13 +++++++------
t/common.perl | 21 ---------------------
t/feed.t | 9 ++++++++-
t/httpd-corner.t | 10 ++++++++++
t/psgi_mount.t | 3 ++-
6 files changed, 28 insertions(+), 29 deletions(-)
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-11-14 6:41 5% [PATCH 0/4] some minor test updates Eric Wong
2019-11-14 6:41 7% ` [PATCH 1/4] t/common: inline stream_to_string into t/feed.t Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).