File: 05.t

package info (click to toggle)
libtext-tabulardisplay-perl 1.22-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 164 kB
  • ctags: 15
  • sloc: perl: 712; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 1,007 bytes parent folder | download
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
33
#!/usr/bin/perl
# vim: set ft=perl:
# $Id: 05.t,v 1.1.1.1 2005/10/04 16:39:58 dlc Exp $
# Test passing arguments to render()

use strict;
use Text::TabularDisplay;
use Test;

BEGIN {
    plan tests => 7;
}

ok(my $t = Text::TabularDisplay->new);
ok(scalar $t->columns("name", "favorite color", "shoe size"));
ok($t->add("Joe Shmoe", "red", "9 1/2"));
ok($t->add("Bob Smith", "chartreuse", "11"));
ok($t->add("John Doe", "mahogany", 13));
ok($t->render(0, 1), 
"+-----------+----------------+-----------+
| name      | favorite color | shoe size |
+-----------+----------------+-----------+
| Joe Shmoe | red            | 9 1/2     |
| Bob Smith | chartreuse     | 11        |
+-----------+----------------+-----------+");

ok($t->render(1, 2), 
"+-----------+----------------+-----------+
| name      | favorite color | shoe size |
+-----------+----------------+-----------+
| Bob Smith | chartreuse     | 11        |
| John Doe  | mahogany       | 13        |
+-----------+----------------+-----------+");