File: bad_blank_line.t

package info (click to toggle)
perl 5.40.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 126,152 kB
  • sloc: ansic: 668,539; perl: 525,522; sh: 72,038; pascal: 6,925; xml: 2,428; yacc: 1,410; makefile: 1,191; cpp: 208; lisp: 1
file content (66 lines) | stat: -rw-r--r-- 2,157 bytes parent folder | download | duplicates (4)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use Test2::Tools::Tiny;
use strict;
use warnings;

use Term::Table;
use Term::Table::Cell;

# This example was produced from the end result of another process, the end
# result is reproduced here in shortcuts:

chomp(my $inner = <<EOT);
+------+-----+-----+-------+--------+
| PATH | GOT | OP  | CHECK | LINES  |
+------+-----+-----+-------+--------+
| [0]  | x   | ANY |> ... <| 26, 30 |
|      |     |     | a     | 27     |
|      |     |     | b     | 28     |
|      |     |     | c     | 29     |
+------+-----+-----+-------+--------+
EOT

my $rows = [[
        '',
        '',
        bless({'value' => $inner},     'Term::Table::Cell'),
        bless({'value' => 'eq'},       'Term::Table::Cell'),
        bless({'value' => ""}, 'Term::Table::Cell'),
        '',
        bless({'value' => '67'}, 'Term::Table::Cell'),
        ''
    ],
];

my $table = Term::Table->new(
    collapse    => 1,
    sanitize    => 1,
    mark_tail   => 1,
    show_header => 1,
    term_size => 80,
    header      => [qw/PATH LINES GOT OP CHECK * LINES NOTES/],
    no_collapse => [qw/GOT CHECK/],
    rows        => $rows,
);

is_deeply(
    [ $table->render ],
    [
        '+-----------------------------------------+----+-------+-------+',
        '| GOT                                     | OP | CHECK | LINES |',
        '+-----------------------------------------+----+-------+-------+',
        '| +------+-----+-----+-------+--------+\n | eq |       | 67    |',
        '| | PATH | GOT | OP  | CHECK | LINES  |\n |    |       |       |',
        '| +------+-----+-----+-------+--------+\n |    |       |       |',
        '| | [0]  | x   | ANY |> ... <| 26, 30 |\n |    |       |       |',
        '| |      |     |     | a     | 27     |\n |    |       |       |',
        '| |      |     |     | b     | 28     |\n |    |       |       |',
        '| |      |     |     | c     | 29     |\n |    |       |       |',
        '| +------+-----+-----+-------+--------+   |    |       |       |',
        '+-----------------------------------------+----+-------+-------+',
    ],
    "Table looks right"
);

print map { "$_\n" } $table->render;

done_testing;