Skip to content

Commit

Permalink
Missing file from previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Waters committed Apr 20, 2012
1 parent 419db6e commit 4d70a01
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions t/011_multirow.t
@@ -0,0 +1,80 @@
use strict;
use warnings;
use utf8;
use Test::More;

BEGIN {
use_ok 'Text::UnicodeBox';
use_ok 'Text::UnicodeBox::Control', qw(:all);
};

$Text::UnicodeBox::Utility::report_on_failure = 1;

my $box = Text::UnicodeBox->new(
whitespace_character => '.',
);
isa_ok $box, 'Text::UnicodeBox';

my @multiline = (
'While I pondered weak and weary',
'over many a curious volume of ',
'forgotten lore '
);

$box->add_line('.', BOX_START( style => 'light', top => 'double' ), " $multiline[0] ", BOX_END(), '.');
$box->add_line('.', BOX_START( style => 'light' ), " $multiline[1] ", BOX_END(), '.');
$box->add_line('.', BOX_START( style => 'light', bottom => 'double' ), " $multiline[2] ", BOX_END(), '.');

is $box->render, <<END_BOX, "Double top/bottom multiline box";
.╒═════════════════════════════════╕.
.│ While I pondered weak and weary │.
.│ over many a curious volume of │.
.│ forgotten lore │.
.╘═════════════════════════════════╛.
END_BOX

# Multi-column and row

$box = Text::UnicodeBox->new(
whitespace_character => '.',
);

$box->add_line(
BOX_START( style => 'heavy', top => 'heavy', bottom => 'heavy' ),
' id ', BOX_RULE, ' ts ', BOX_RULE, ' log ',
BOX_END()
);

is $box->render, <<END_BOX, "Multi-column box";
┏━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ id ┃ ts ┃ log ┃
┗━━━━┻━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━┛
END_BOX

# Multi-column and multi-row

$box = Text::UnicodeBox->new(
whitespace_character => '.',
);

$box->add_line(
BOX_START( style => 'heavy', top => 'heavy', bottom => 'heavy' ),
' id ', BOX_RULE, ' ts ', BOX_RULE, ' log ',
BOX_END()
);

$box->add_line(
BOX_START( style => 'light', bottom => 'light' ),
' 2 ', BOX_RULE, ' 2012-04-16 16:30:43 ', BOX_RULE, ' Eric was here ',
BOX_END()
);

is $box->render, <<END_BOX, "Multi-column, multi-row box with separation";
┏━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ id ┃ ts ┃ log ┃
┡━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ 2 │ 2012-04-16 16:30:43 │ Eric was here │
└────┴─────────────────────┴─────────────────────┘
END_BOX

done_testing;

0 comments on commit 4d70a01

Please sign in to comment.