]> git.donarmstrong.com Git - term-progressbar.git/blobdiff - t/v2-message.t
upgrade Capture::Tiny and use the new capture_stderr
[term-progressbar.git] / t / v2-message.t
index 10430b3a9ffc83fee7f4c280d6937104a024ea90..0b2b5281907bef833a2dce75cd3ceab2303dba22 100644 (file)
@@ -12,7 +12,7 @@ This package tests the basic functionality of Term::ProgressBar.
 use Test::More tests => 11;
 use Test::Exception;
 
-use Capture::Tiny qw(capture);
+use Capture::Tiny qw(capture_stderr);
 
 my $MESSAGE1 = 'Walking on the Milky Way';
 
@@ -44,14 +44,13 @@ Update it it from 1 to 10.  Output a message halfway through.
 
 =cut
 {
-  my ($out, $err) = capture {
+  my $err = capture_stderr {
     my $p;
     lives_ok { $p = Term::ProgressBar->new(10); } 'Count 1-10 (1)';
     lives_ok { $p->update($_) for 1..5  }         'Count 1-10 (2)';
     lives_ok { $p->message($MESSAGE1)    }         'Count 1-10 (3)';
     lives_ok { $p->update($_) for 6..10 }         'Count 1-10 (4)';
   };
-  print $out;
 
   $err =~ s!^.*\r!!gm;
   diag "ERR:\n$err\nlength: " . length($err)
@@ -78,12 +77,11 @@ This is to check that message preserves the progress bar value correctly.
 =cut
 
 {
-  my ($out, $err) = capture {
+  my $err = capture_stderr {
     my $p;
     lives_ok { $p = Term::ProgressBar->new(100); } 'Message Check ( 1)';
     lives_ok { for (0..100) { $p->update($_); $p->message("Hello") } }  'Message Check ( 2)';
   };
-  print $out;
 
   my @err_lines = split /\n/, $err;
   (my $last_line = $err_lines[-1]) =~ tr/\r//d;