File: 10_pages.t

package info (click to toggle)
libtext-asciitable-perl 0.18-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 168 kB
  • ctags: 47
  • sloc: perl: 896; makefile: 45
file content (26 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl

BEGIN { $| = 1; print "1..4\n"; }
END {print "not ok 1\n" unless $loaded;}
use Text::ASCIITable;
$loaded = 1;
print "ok 1\n";
$i=2;

$t = new Text::ASCIITable({'outputWidth' => 40});
$t->setCols(['Name','Description','Amount']);
$t->addRow('Apple',"A fruit. (very tasty!)",4);
$t->addRow('Milk',"Testing the page stuff.",2);
$t->addRow('Egg','Usually from birds.',6);
ok($t->pageCount()==2?undef:1);
$out='';
eval {
  for my $side (1..$t->pageCount()) {
    $out .= $t->drawPage($side)."\n";
  }
};
if (!$@) {ok(undef)} else {ok(1)}
@arr = split(/\n/,$out);
if (scalar(@arr) == 15) {ok(undef);} else {ok(1);}

sub ok{print(defined(shift)?"not ok $i\n":"ok $i\n");$i++;}