]> git.donarmstrong.com Git - term-progressbar-io.git/blob - t/02_basic_test.t
initial work on Term::ProgressBar::IO
[term-progressbar-io.git] / t / 02_basic_test.t
1 # -*- mode: cperl; -*-
2 use Test::More;
3
4 use_ok('Term::ProgressBar::IO');
5
6 use IO::File;
7
8 my $fh = IO::File->new('t/random_file','r') or
9     die "Unable to open t/random_file for reading: $!";
10
11 my $pb = Term::ProgressBar::IO->new($fh);
12
13 ok($pb->target() == 9*2+3,'Correct number of bytes in __DATA__');
14
15 while (<$fh>) {
16     $pb->update();
17 }
18
19 print STDERR $pb->last_update();
20 ok($pb->last_update() == $pb->target(),'Last position is now target');
21
22 close($fh);
23
24 done_testing();