File: test.pl

package info (click to toggle)
libtext-formattable-perl 1.01-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 72 kB
  • ctags: 25
  • sloc: perl: 404; makefile: 45
file content (32 lines) | stat: -rw-r--r-- 697 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
use Test;
BEGIN { plan tests => 2 };
use Text::FormatTable;
ok(1); # If we made it this far, we're ok.

my $table = Text::FormatTable->new('r| l l');
$table->head('a', 'b', 'c');
$table->rule('=');
$table->row('this a test, a nice test', 'oh, cool, a test!', 'yep');
$table->rule;
$table->row('you mean it\'s really a test?', 'yes, it is.', 'z');
$table->rule('=');
my $is = $table->render(15);

my $shouldbe = <<'END';
     a| b     c  
=================
this a| oh,   yep
 test,| cool,    
a nice| a        
  test| test!    
------+----------
   you| yes,  z  
  mean| it       
  it's| is.      
really|          
     a|          
 test?|          
=================
END

ok($is, $shouldbe);