]> git.donarmstrong.com Git - term-progressbar.git/commitdiff
upgrade Capture::Tiny and use the new capture_stderr
authorGabor Szabo <szabgab@gmail.com>
Fri, 2 Dec 2011 06:39:19 +0000 (08:39 +0200)
committerGabor Szabo <szabgab@gmail.com>
Fri, 2 Dec 2011 06:39:19 +0000 (08:39 +0200)
Makefile.PL
t/eta-linear.t
t/name.t
t/v1-message.t
t/v2-message.t
t/v2-mobile.t
t/v2-simple.t
t/zero.t

index 64d3e2baedcbe8f0be4d5ebb8c8c987be93bfaa8..85dc57cd1f416932236b2b92d002a573ca00bdde 100644 (file)
@@ -12,7 +12,7 @@ WriteMakefile (
                      'Class::MethodMaker' => '1.02',
                      'Term::ReadKey' => '2.14',},
   BUILD_REQUIRES => {
-                     'Capture::Tiny' => '0.11',
+                     'Capture::Tiny' => '0.12',
                      'Test::More'    => '0.80',
                      'Test::Exception' => '0.31',
                      'File::Temp'    => 0,
index 3d4f06b3c2bcc89e9330995d9d993a96ac7692ef..5a80016e894a7190ebb2b602363833d199d6c362 100644 (file)
@@ -12,7 +12,7 @@ This package tests the basic functionality of Term::ProgressBar.
 use Test::More tests => 9;
 use Test::Exception;
 
-use Capture::Tiny qw(capture);
+use Capture::Tiny qw(capture_stderr);
 
 use Term::ProgressBar;
 
@@ -38,7 +38,7 @@ Update it it from 1 to 10.
 =cut
 
 {
-  my ($out, $err) = capture {
+  my $err = capture_stderr {
     my $p;
     lives_ok {
                 $p = Term::ProgressBar->new({count => 10, name => 'fred',
@@ -49,7 +49,6 @@ Update it it from 1 to 10.
     lives_ok { $p->message('Hello Mum!') }  'Count 1-10 (3)';
     lives_ok { for (6..10) { $p->update($_); sleep 1 } } 'Count 1-10 (4)';
   };
-  print $out;
 
   my @lines = grep $_ ne '', split /[\n\r]+/, $err;
   diag explain \@lines
index e89f4862eb518dbe026022b53052a8f9f79d76f9..d073516c8644eed736658b6f98ff04a136d04d1b 100644 (file)
--- a/t/name.t
+++ b/t/name.t
@@ -12,7 +12,7 @@ This package tests the name functionality of Term::ProgressBar.
 use Test::More tests => 20;
 use Test::Exception;
 
-use Capture::Tiny qw(capture);
+use Capture::Tiny qw(capture_stderr);
 
 my $MESSAGE1 = 'The Gospel of St. Jude';
 my $NAME1    = 'Algenon';
@@ -43,13 +43,12 @@ Update it it from 1 to 10.
 
 {
   my $p;
-  my ($out, $err) = capture {
+  my $err = capture_stderr {
     lives_ok {
                 $p = Term::ProgressBar->new({count => 10, name => $NAME1});
               } 'Count 1-10 ( 1)';
     lives_ok { $p->update($_) for 1..3  } 'Count 1-10 ( 2)';
   };
-  print $out;
 
   $err =~ s!^.*\r!!gm;
   diag "ERR (1) :\n$err\nlength: " . length($err)
@@ -67,11 +66,10 @@ Update it it from 1 to 10.
   cmp_ok length($bar), '<', $barexpect+1;
 
 
-  ($out, $err) = capture {
+  $err = capture_stderr {
     lives_ok { $p->message($MESSAGE1)    } 'Count 1-10 ( 5)';
     lives_ok { $p->update($_) for 6..10 } 'Count 1-10 ( 6)';
   };
-  print $out;
 
   $err =~ s!^.*\r!!gm;
   diag "ERR (2) :\n$err\nlength: " . length($err)
@@ -106,11 +104,10 @@ Use v1 mode
 
 {
   my $p;
-  my ($out, $err) = capture {
+  my $err = capture_stderr {
     lives_ok { $p = Term::ProgressBar->new($NAME2, 10); } 'Count 1-10 ( 1)';
     lives_ok { $p->update($_) for 1..3  }                'Count 1-10 ( 2)';
   };
-  print $out;
 
   $err =~ s!^.*\r!!gm;
   diag "ERR (1) :\n$err\nlength: " . length($err)
@@ -127,11 +124,10 @@ Use v1 mode
   cmp_ok length($bar), '>', $barexpect -1;
   cmp_ok length($bar), '<', $barexpect+1;
   
-  ($out, $err) = capture {
+  $err = capture_stderr {
     lives_ok { $p->message($MESSAGE1)    }  'Count 1-10 ( 5)';
     lives_ok { $p->update($_) for 6..10 }  'Count 1-10 ( 6)';
   };
-  print $out;
 
   $err =~ s!^.*\r!!gm;
   diag "ERR (2) :\n$err\nlength: " . length($err)
index 3428ff808f2ddff6ea1aeeed2ee7830027f28c9e..9a95824b9554c18bf56bb0ca03d0fa9824b15bd1 100644 (file)
@@ -12,7 +12,7 @@ This package tests the basic functionality of Term::ProgressBar.
 use Test::More tests => 8;
 use Test::Exception;
 
-use Capture::Tiny qw(capture);
+use Capture::Tiny qw(capture_stderr);
 
 my $MESSAGE1 = 'Walking on the Milky Way';
 
@@ -39,14 +39,13 @@ Update it it from 1 to 10.
 =cut
 
 {
-  my ($out, $err) = capture {
+  my $err = capture_stderr {
     my $p;
     lives_ok { $p = Term::ProgressBar->new('bob', 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)
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;
index dd42ea3f0d52b476d890ecbde1873b35d37fe274..342d06ffb11f52f7eec223735df3fe3316803957 100644 (file)
@@ -12,7 +12,7 @@ This package tests the moving target functionality of Term::ProgressBar.
 use Test::More tests => 7;
 use Test::Exception;
 
-use Capture::Tiny qw(capture);
+use Capture::Tiny qw(capture_stderr);
 
 use_ok 'Term::ProgressBar';
 
@@ -36,14 +36,13 @@ Update it from 11 to 20.
 
 =cut
 
-my ($out, $err) = capture {
+my $err = capture_stderr {
   my $p;
   lives_ok { $p = Term::ProgressBar->new(10); } 'Count 1-20 (1)';
   lives_ok { $p->update($_) for 1..5  }    'Count 1-20 (2)';
   lives_ok { $p->target(20)    }           'Count 1-20 (3)';
   lives_ok { $p->update($_) for 11..20 }   'Count 1-20 (4)';
 };
-print $out;
 
 $err =~ s!^.*\r!!gm;
 diag "ERR:\n$err\nlength: " . length($err)
index 439594f3534773f495369e4c594ca03593b21a14..37f9d6079fca7a2d1a9e44faf279416dedd6cd79 100644 (file)
@@ -12,7 +12,7 @@ This package tests the basic functionality of Term::ProgressBar.
 use Test::More tests => 31;
 use Test::Exception;
 
-use Capture::Tiny qw(capture);
+use Capture::Tiny qw(capture_stderr);
 
 use_ok 'Term::ProgressBar';
 
@@ -33,12 +33,11 @@ Update it it from 1 to 10.
 
 =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..10 } 'Count 1-10 (2)';
   };
-  print $out;
 
   my @lines = grep {$_ ne ''} split /\r/, $err;
   diag explain \@lines
@@ -64,12 +63,11 @@ Update it it from 1 to 9.
 =cut
 
 {
-  my ($out, $err) = capture {
+  my $err = capture_stderr {
     my $p;
     lives_ok { $p = Term::ProgressBar->new(10); } 'Count 1-9 (1)';
     lives_ok { $p->update($_) for 1..9 } 'Count 1-9 (2)';
   };
-  print $out;
 
   my @lines = grep $_ ne '', split /\r/, $err;
   diag explain \@lines
@@ -89,11 +87,10 @@ percentage or displayed bar).
 
 =cut
 {
-  my ($out, $err) = capture {
+  my $err = capture_stderr {
     my $tp = Term::ProgressBar->new(1000000);
     $tp->update($_) foreach (0, 1);
   };
-  #print $out;
 
   my @lines = grep {$_ ne ''} split /\r/, $err;
   diag explain \@lines
index fda3d35ae5f33ab040f309bcbddfe4413f8b21f4..ee51f2b9b4e4f2127ede1198063cfa287c139def 100644 (file)
--- a/t/zero.t
+++ b/t/zero.t
@@ -12,7 +12,7 @@ This package tests the zero-progress handling of progress bar.
 use Test::More tests => 9;
 use Test::Exception;
 
-use Capture::Tiny qw(capture);
+use Capture::Tiny qw(capture_stderr);
 
 use_ok 'Term::ProgressBar';
 
@@ -35,11 +35,10 @@ Update it it from 1 to 10.
 {
   my $p;
   my $name = 'doing nothing';
-  my ($out, $err)  = capture {
+  my $err  = capture_stderr {
     lives_ok { $p = Term::ProgressBar->new($name, 0); } 'V1 mode ( 1)';
     lives_ok { $p->update($_) for 1..10 } 'V1 mode ( 2)';
   };
-  print $out;
 
   my @lines = grep { $_ ne ''} split /\r/, $err;
   diag explain @lines
@@ -65,11 +64,10 @@ Update it it from 1 to 10.
 {
   my $p;
   my $name = 'zero';
-  my ($out, $err) = capture {
+  my $err = capture_stderr {
     lives_ok { $p = Term::ProgressBar->new({ count => 0, name => $name }); } 'V2 mode ( 1)';
     lives_ok { $p->update($_) for 1..10 } 'V2 mode ( 2)';
   };
-  print $out;
 
   my @lines = grep {$_ ne ''} split /\r/, $err;
   diag explain @lines