File Coverage

t/PerlySense-smart-doc-pod.t
Criterion Covered Total %
statement 101 101 100.0
branch 1 2 50.0
condition n/a
subroutine 10 10 100.0
pod n/a
total 112 113 99.1


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2 1     1   112442 use strict;
  1         3  
  1         66  
3              
4 1     1   549 use Test::More tests => 55;
  1         14687  
  1         7  
5 1     1   630 use Test::Exception;
  1         2515  
  1         4  
6              
7 1     1   207 use File::Basename;
  1         2  
  1         94  
8 1     1   261 use File::Spec::Functions;
  1         471  
  1         58  
9 1     1   405 use Data::Dumper;
  1         6120  
  1         57  
10              
11 1     1   338 use lib "../lib";
  1         535  
  1         3  
12              
13 1     1   70032 use_ok("Devel::PerlySense");
  1         698  
  1         3  
  1         3  
  1         7  
14 1     1   274 use_ok("Devel::PerlySense::Document::Location");
  1         76  
  1         2  
  1         1  
  1         8  
15              
16              
17 1 50   1   2032 BEGIN { -d "t" and chdir("t"); }
18              
19              
20 1         196 ok(my $oPs = Devel::PerlySense->new(), "new ok");
21              
22              
23              
24 1         198 my $dirData = "data/simple-lib";
25 1         3 my $fileOrigin = "$dirData/lib/Win32/Word/Writer.pm";
26 1         2 my $text;
27 1         1 my $oLocation;
28 1         2 my $rex;
29              
30              
31 1         15 print "\n* Docs for method call\n";
32              
33              
34             #Should be reinstated / changed to either report the variable or not find anything at all, once variables are parsed for
35 1         5 ok($oLocation = $oPs->oLocationSmartDoc(file => $fileOrigin, row => 420, col => 17), "Didn't find hOpt");
36 1         346 is($oLocation->file, $fileOrigin, " In correct file");
37 1         220 is($oLocation->row, 1, " row");
38 1         620 is($oLocation->col, 1, " col");
39              
40              
41              
42 1         192 $text = q{METHODS - ADDING TEXT
43             NewParagraph([heading => $level], [style => $name])
44             Start a new paragraph of heading $level or with style $name. The style
45             overrides heading. The style should be a paragraph style.
46              
47             The default style is "Normal".};
48 1         6 ok($oLocation = $oPs->oLocationSmartDoc(file => $fileOrigin, row => 423, col => 21), "Found POD ok");
49 1         333 is($oLocation->rhProperty->{text}, $text, " Found POD text ok");
50 1         224 is($oLocation->file, $fileOrigin, " In correct file");
51 1         622 is($oLocation->row, 438, " row");
52 1         213 is($oLocation->col, 1, " col");
53 1         210 is($oLocation->rhProperty->{docType}, "hint", " docType method");
54 1         211 is($oLocation->rhProperty->{found}, "method", " docType method");
55 1         219 is($oLocation->rhProperty->{name}, "NewParagraph", " name");
56              
57              
58 1         185 $text = q{METHODS - ADDING TEXT
59             Write($text)
60             Append $text to the document (using the current style etc).};
61 1         4 ok($oLocation = $oPs->oLocationSmartDoc(file => $fileOrigin, row => 429, col => 14), "Found POD ok");
62 1         302 is($oLocation->rhProperty->{text}, $text, " Found POD text ok");
63 1         217 is($oLocation->file, $fileOrigin, " In correct file");
64 1         210 is($oLocation->row, 391, " row");
65 1         210 is($oLocation->col, 1, " col");
66 1         248 is($oLocation->rhProperty->{docType}, "hint", " docType method");
67 1         205 is($oLocation->rhProperty->{found}, "method", " docType method");
68 1         206 is($oLocation->rhProperty->{name}, "Write", " name");
69              
70              
71              
72 1         183 print "\n* Docs for module POD\n";
73              
74              
75 1         5 $rex = qr{Win32::Word::Writer::Table - Add tables to Word documents}s;
76 1         4 ok($oLocation = $oPs->oLocationSmartDoc(file => $fileOrigin, row => 157, col => 14), "Found module POD ok");
77 1         293 like($oLocation->rhProperty->{text}, $rex, " Found POD text ok");
78 1         209 like($oLocation->file, qr/Writer.Table\.pm/, " In correct file");
79 1         292 is($oLocation->row, 1, " row");
80 1         210 is($oLocation->col, 1, " col");
81 1         208 is($oLocation->rhProperty->{"found"}, "module", " docType module");
82 1         205 is($oLocation->rhProperty->{docType}, "document", " docType module");
83 1         205 is($oLocation->rhProperty->{name}, "Win32::Word::Writer::Table", " name");
84              
85              
86              
87 1         184 $rex = qr{Win32::Word::Writer - Create Microsoft Word documents}s;
88 1         5 ok($oLocation = $oPs->oLocationSmartDoc(file => $fileOrigin, row => 201, col => 3), "Found nothing, in between tokens");
89 1         302 like($oLocation->rhProperty->{text}, $rex, " Found POD text ok");
90 1         212 like($oLocation->file, qr/Writer\.pm/, " In correct file");
91 1         212 is($oLocation->row, 1, " row");
92 1         211 is($oLocation->col, 1, " col");
93 1         207 is($oLocation->rhProperty->{"found"}, "module", " docType module");
94 1         207 is($oLocation->rhProperty->{docType}, "document", " docType module");
95 1         206 is($oLocation->rhProperty->{name}, "Win32::Word::Writer", " name");
96              
97              
98 1         185 ok( $oPs->oLocationSmartDoc(file => $fileOrigin, row => 420, col => 5234), "Didn't find anything at point at far right, returned entire POD for the file");
99 1         301 like($oLocation->rhProperty->{text}, $rex, " Found POD text ok");
100 1         209 like($oLocation->file, qr/Writer\.pm/, " In correct file");
101 1         207 is($oLocation->row, 1, " row");
102 1         208 is($oLocation->col, 1, " col");
103 1         206 is($oLocation->rhProperty->{"found"}, "module", " docType module");
104 1         206 is($oLocation->rhProperty->{docType}, "document", " docType module");
105 1         205 is($oLocation->rhProperty->{name}, "Win32::Word::Writer", " name");
106              
107              
108              
109              
110 1         187 print "\n* Docs for class method POD in base class\n";
111              
112              
113 1         3 $dirData = "data/project-lib";
114 1         2 $fileOrigin = "$dirData/Game/Application.pm";
115 1         3 my $rexFile = qr/Game.Object.Worm.pm/;
116              
117 1         2 $text = q{CLASS METHODS
118             loadFile($file)
119             Bogus test method to have something to test with.
120              
121             From <Game::Object::Worm>};
122 1         5 ok($oLocation = $oPs->oLocationSmartDoc(file => $fileOrigin, row => 167, col => 44), "Found POD ok");
123 1         300 is($oLocation->rhProperty->{text}, $text, " Found POD text ok");
124 1         210 like($oLocation->file, $rexFile, " In correct file");
125 1         210 is($oLocation->row, 355, " row");
126 1         218 is($oLocation->col, 1, " col");
127 1         203 is($oLocation->rhProperty->{docType}, "hint", " docType method");
128 1         204 is($oLocation->rhProperty->{found}, "method", " docType method");
129 1         204 is($oLocation->rhProperty->{name}, "loadFile", " name");
130              
131              
132              
133              
134              
135             __END__