File: 11_Variable_Rule.t

package info (click to toggle)
libtext-table-perl 1.135-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 264 kB
  • sloc: perl: 906; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 579 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
use strict;
use warnings;

use Test::More tests => 1;

use Text::Table;

### separators and rules
my $tb = Text::Table->new( \'||', 'aaa', \'|', 'bbb', \'|', 'ccc', \'||');

# TEST
is ($tb->rule(
        sub {
            my ($i, $len) = @_;

            return (($i == 0) ? ("X" x $len) : ($i == 2) ? ("Y" x $len) :
                ("A" x $len))
            ;
        },
        sub {
            my ($i, $len) = @_;
            return (($i == 0) ? "|=" : ($i == 3) ? "=|" : "+");
        },
    ),
    "|=XXX+AAA+YYY=|\n",
    "Create a variable rule based on callbacks.",
);