This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=7d2d5be9fb48c79d25991e5ab4da2a4f6419d241

commit 7d2d5be9fb48c79d25991e5ab4da2a4f6419d241
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Tue Aug 18 02:08:00 2020 +0200

    test: Improve dpkg-divert test to output stdout and stderr
    
    This makes spotting unexpected values, or output from sanitizers easier.
---
 src/t/dpkg_divert.t | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/t/dpkg_divert.t b/src/t/dpkg_divert.t
index cf118e212..b24f8856f 100644
--- a/src/t/dpkg_divert.t
+++ b/src/t/dpkg_divert.t
@@ -90,13 +90,17 @@ sub call {
           to_pipe => \$output, error_to_pipe => \$error, %opts);
 
     if ($opts{expect_failure}) {
-        ok($? != 0, "@$args should fail");
+        ok($? != 0, "@$args should fail: $?");
     } else  {
-        ok($? == 0, "@$args should not fail");
+        ok($? == 0, "@$args should not fail: $?");
     }
 
+    my @output = <$output>;
+    my @error = <$error>;
+    note("stdout <<<@output>>>");
+    note("stderr <<<@error>>>");
+
     if (defined $opts{expect_stdout}) {
-        my (@output) = <$output>;
         my (@expect) = split(/^/, $opts{expect_stdout});
         if (defined $opts{expect_sorted_stdout}) {
             @output = sort @output;
@@ -105,13 +109,13 @@ sub call {
         is(join('', @output), join('', @expect), "@$args stdout");
     }
     if (defined $opts{expect_stdout_like}) {
-        like(file_slurp($output), $opts{expect_stdout_like}, "@$args stdout");
+        like("@output", $opts{expect_stdout_like}, "@$args stdout");
     }
     if (defined $opts{expect_stderr}) {
-        is(file_slurp($error), $opts{expect_stderr}, "@$args stderr");
+        is("@error", $opts{expect_stderr}, "@$args stderr");
     }
     if (defined $opts{expect_stderr_like}) {
-        like(file_slurp($error), $opts{expect_stderr_like}, "@$args stderr");
+        like("@error", $opts{expect_stderr_like}, "@$args stderr");
     }
 
     close($output);

-- 
Dpkg.Org's dpkg

Reply via email to