]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/qspawn.t: psgi_qx stderr test
authorEric Wong <e@80x24.org>
Tue, 22 Jan 2019 07:57:06 +0000 (07:57 +0000)
committerEric Wong <e@80x24.org>
Sat, 26 Jan 2019 23:05:46 +0000 (23:05 +0000)
t/qspawn.t

index 170e4d7f4e8d4e66276846d1720402df1c562a3b..745ec4d8134cf6c3662d2596fa6e9abf4bf29e04 100644 (file)
@@ -1,8 +1,16 @@
-# Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use Test::More;
 use_ok 'PublicInbox::Qspawn';
 
+{
+       my $cmd = [qw(sh -c), 'echo >&2 err; echo out'];
+       my $qsp = PublicInbox::Qspawn->new($cmd, {}, { 2 => 1 });
+       my $res;
+       $qsp->psgi_qx({}, undef, sub { $res = ${$_[0]} });
+       is($res, "err\nout\n", 'captured stderr and stdout');
+}
+
 my $limiter = PublicInbox::Qspawn::Limiter->new(1);
 {
        my $x = PublicInbox::Qspawn->new([qw(true)]);