X-Git-Url: https://git.donarmstrong.com/?p=term-progressbar.git;a=blobdiff_plain;f=t%2Fv2-mobile.t;fp=t%2Fv2-mobile.t;h=5021f2d6f3a4cd20e218a3d3f8f933fd6f5dc62b;hp=dca40621682c94ed8f55849f35c29b9283a6f713;hb=8f87af0520c5dbcedbfe74dd6ef6e7826f200263;hpb=7966daddf59dcdf39b4ba3a6aa33424624c81d7e diff --git a/t/v2-mobile.t b/t/v2-mobile.t index dca4062..5021f2d 100644 --- a/t/v2-mobile.t +++ b/t/v2-mobile.t @@ -10,29 +10,14 @@ This package tests the moving target functionality of Term::ProgressBar. use Data::Dumper qw( Dumper ); use FindBin qw( $Bin ); -use Test qw( ok plan ); +use Test::More tests => 7; use lib $Bin; use test qw( evcheck ); use Capture::Tiny qw(capture); -BEGIN { - # 1 for compilation test, - plan tests => 7, - todo => [], -} - -=head2 Test 1: compilation - -This test confirms that the test script and the modules it calls compiled -successfully. - -=cut - -use Term::ProgressBar; - -ok 1, 1, 'compilation'; +use_ok 'Term::ProgressBar'; Term::ProgressBar->__force_term (50); @@ -57,13 +42,13 @@ Update it from 11 to 20. my ($out, $err) = capture { my $p; ok (evcheck(sub { $p = Term::ProgressBar->new(10); }, 'Count 1-20 (1)' ), - 1, 'Count 1-20 (1)'); + 'Count 1-20 (1)'); ok (evcheck(sub { $p->update($_) for 1..5 }, 'Count 1-20 (2)' ), - 1, 'Count 1-20 (2)'); + 'Count 1-20 (2)'); ok (evcheck(sub { $p->target(20) }, 'Count 1-20 (3)' ), - 1, 'Count 1-20 (3)'); + 'Count 1-20 (3)'); ok (evcheck(sub { $p->update($_) for 11..20 }, 'Count 1-20 (4)' ), - 1, 'Count 1-20 (4)'); + 'Count 1-20 (4)'); }; print $out; @@ -73,5 +58,5 @@ print $out; my @lines = split /\n/, $err; - ok $lines[-1], qr/\[=+\]/, 'Count 1-20 (5)'; - ok $lines[-1], qr/^\s*100%/, 'Count 1-20 (6)'; + like $lines[-1], qr/\[=+\]/, 'Count 1-20 (5)'; + like $lines[-1], qr/^\s*100%/, 'Count 1-20 (6)';