X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=t%2Fv2-message.t;h=0b2b5281907bef833a2dce75cd3ceab2303dba22;hb=ce993e7fe8ecb319c0bf3e625f9f909127b01308;hp=10430b3a9ffc83fee7f4c280d6937104a024ea90;hpb=834c61514d3dc3eb32aa31f14431c851a8cc62d3;p=term-progressbar.git diff --git a/t/v2-message.t b/t/v2-message.t index 10430b3..0b2b528 100644 --- a/t/v2-message.t +++ b/t/v2-message.t @@ -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;