File Coverage

t/PerlySense-Editor-fit-columns.t
Criterion Covered Total %
statement 54 54 100.0
branch 1 2 50.0
condition n/a
subroutine 11 11 100.0
pod n/a
total 66 67 98.5


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2 1     1   154370 use strict;
  1         2  
  1         363  
3              
4 1     1   1165 use Test::More tests => 14;
  1         15961  
  1         7  
5 1     1   1384 use Test::Exception;
  1         2919  
  1         4  
6 1     1   573 use Test::Differences;
  1         11976  
  1         57  
7              
8 1     1   454 use Data::Dumper;
  1         6070  
  1         48  
9              
10              
11 1     1   554 use lib "../lib";
  1         525  
  1         3  
12              
13 1     1   100953 use_ok("Devel::PerlySense");
  1         629  
  1         2  
  1         2  
  1         5  
14 1     1   269 use_ok("Devel::PerlySense::Class");
  1         72  
  1         1  
  1         2  
  1         6  
15 1     1   192 use_ok("Devel::PerlySense::Editor::Emacs");
  1         335  
  1         2  
  1         1  
  1         10  
16              
17              
18 1 50   1   1501 BEGIN { -d "t" and chdir("t"); }
19              
20              
21              
22 1         305 ok(my $oPerlySense = Devel::PerlySense->new(), "Created PerlySense object ok");
23 1         213 ok(
24             my $oEditor = Devel::PerlySense::Editor::Emacs->new(
25             oPerlySense => $oPerlySense,
26             widthDisplay => undef,
27             ),
28             "Created Editor ok",
29             );
30              
31              
32 1         185 my $raItem;
33              
34              
35              
36 1         3 $raItem = [qw/ a b /];
37             is(
38 1     4   9 $oEditor->textTable($raItem, 1, sub { "($_[0])(@{$_[1]})" } ),
  4         5  
  4         13  
39             "(a)(a b)\n(b)(a b)\n",
40             "One item, with renderer",
41             );
42              
43              
44              
45 1         275 $raItem = [];
46 1         4 is(
47             $oEditor->textTable($raItem, 1),
48             "",
49             "No items, 1 col",
50             );
51 1         190 is(
52             $oEditor->textTable($raItem, 10),
53             "",
54             "No items, 10 col",
55             );
56              
57              
58              
59 1         185 $raItem = [qw/ a /];
60 1         3 is(
61             $oEditor->textTable($raItem, 1),
62             "a\n",
63             "One item, single col",
64             );
65 1         189 is(
66             $oEditor->textTable($raItem, 10),
67             "a\n",
68             "One item, very wide col",
69             );
70              
71              
72 1         184 $raItem = [qw/ a b /];
73 1         3 is(
74             $oEditor->textTable($raItem, 1),
75             "a\nb\n",
76             "Two items, one col",
77             );
78 1         192 is(
79             $oEditor->textTable($raItem, 10),
80             "a b\n",
81             "Two items, wide",
82             );
83              
84 1         189 $raItem = [qw/ a b c d e f g h i j k /];
85 1         3 is(
86             $oEditor->textTable($raItem, 5),
87             "a e i
88             b f j
89             c g k
90             d h \n",
91             "12 Items, five cols",
92             );
93              
94              
95 1         248 $raItem = [qw/ abc b c d e f g h i j k /];
96 1         6 is(
97             $oEditor->textTable($raItem, 7),
98             "abc e i
99             b f j
100             c g k
101             d h \n",
102             "12 Items with varied widths, five cols",
103             );
104              
105              
106              
107             __END__
108