Algorithm-Diff-HTMLTable
view release on metacpan or search on metacpan
t/08_add_tablerow.t view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::LongString;
use Algorithm::Diff::HTMLTable;
my $table = Algorithm::Diff::HTMLTable->new;
{
my $row = $table->_add_tablerow(
line_nr_a => 20,
line_nr_b => 19,
);
my $check = q~
<tr style="border: 1px solid">
<td style="background-color: gray">20</td>
<td ></td>
<td style="background-color: gray">19</td>
<td ></td>
</tr>
~;
is_string $row, $check;
}
{
my $row = $table->_add_tablerow(
line_nr_a => 20,
line_a => 'This is a T"est',
line_nr_b => 19,
);
my $check = q~
<tr style="border: 1px solid">
<td style="background-color: gray">20</td>
<td >This is a T"est</td>
<td style="background-color: gray">19</td>
<td ></td>
</tr>
~;
is_string $row, $check;
}
{
my $row = $table->_add_tablerow(
line_nr_a => 20,
line_a => 'This is a T"est',
line_b => 'This is a T"est',
line_nr_b => 19,
);
my $check = q~
<tr style="border: 1px solid">
<td style="background-color: gray">20</td>
<td >This is a T"est</td>
<td style="background-color: gray">19</td>
<td >This is a T"est</td>
</tr>
~;
is_string $row, $check;
}
{
my $row = $table->_add_tablerow(
line_nr_a => 20,
line_b => 'This is a T"est',
line_nr_b => 19,
);
my $check = q~
<tr style="border: 1px solid">
<td style="background-color: gray">20</td>
<td ></td>
<td style="background-color: gray">19</td>
<td >This is a T"est</td>
</tr>
~;
is_string $row, $check;
}
{
my $row = $table->_add_tablerow(
line_nr_a => 20,
line_b => 'This is a T"est',
color_b => 'green',
line_nr_b => 19,
);
my $check = q~
<tr style="border: 1px solid">
<td style="background-color: gray">20</td>
<td ></td>
<td style="background-color: gray">19</td>
<td style="color: green;">This is a T"est</td>
</tr>
~;
is_string $row, $check;
}
done_testing();
( run in 1.007 second using v1.01-cache-2.11-cpan-f5b5a18a01a )