File Coverage

t/PerlySense-Editor-Vim-output.t
Criterion Covered Total %
statement 38 38 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 46 46 100.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2 1     1   130839 use strict;
  1         2  
  1         70  
3              
4 1     1   498 use Test::More tests => 12;
  1         15944  
  1         8  
5 1     1   719 use Test::Exception;
  1         2553  
  1         4  
6 1     1   567 use Test::Differences;
  1         10151  
  1         57  
7              
8 1     1   421 use Data::Dumper;
  1         5134  
  1         43  
9              
10              
11 1     1   276 use lib "lib";
  1         529  
  1         3  
12              
13 1     1   75229 use_ok("Devel::PerlySense");
  1         867  
  1         3  
  1         1  
  1         7  
14 1     1   300 use_ok("Devel::PerlySense::Editor::Vim");
  1         23900  
  1         2  
  1         1  
  1         8  
15              
16              
17              
18              
19 1         283 ok(my $oPerlySense = Devel::PerlySense->new(), "Created PerlySense object ok");
20 1         202 ok(
21             my $oEditor = Devel::PerlySense::Editor::Vim->new(
22             oPerlySense => $oPerlySense,
23             widthDisplay => 10,
24             ),
25             "Created Editor ok",
26             );
27              
28              
29              
30 1         189 my %identifier_input_output = (
31             "a" => "a",
32             "a_b" => "a_b",
33             "c-d" => "c-d",
34             "c*d" => "c*d",
35             "c d" => "c d",
36             );
37              
38 1         15 for my $input (sort keys %identifier_input_output) {
39 5         751 my $output = $identifier_input_output{$input};
40 5         13 is($oEditor->renameIdentifier($input), $output, "Identifier ($input) -> ($output)");
41             }
42              
43              
44              
45              
46              
47 1         191 note("Vim data structure");
48              
49 1         48 is(
50             $oEditor->formatOutputDataStructure(
51             rhData => {
52             hej => "Baberiba",
53             2 => "two",
54             },
55             ),
56             qq|{"2": "two", "hej": "Baberiba"}|,
57             "Simple structure ok",
58             );
59              
60 1         193 is(
61             $oEditor->formatOutputDataStructure(
62             rhData => {
63             hej => [ "Ba", "beriba" ],
64             2 => "two",
65             },
66             ),
67             qq|{"2": "two", "hej": ["Ba", "beriba"]}|,
68             "Array ref ok",
69             );
70              
71 1         193 is(
72             $oEditor->formatOutputDataStructure(
73             rhData => {
74             hej => { "Ba" => "beriba", Hej => "Baberiba" },
75             2 => "two",
76             },
77             ),
78             qq|{"2": "two", "hej": {"Ba": "beriba", "Hej": "Baberiba"}}|,
79             "Array ref ok",
80             );
81              
82              
83              
84              
85              
86             __END__