File Coverage

t/PerlySense-Document-module.t
Criterion Covered Total %
statement 49 49 100.0
branch 1 2 50.0
condition n/a
subroutine 9 9 100.0
pod n/a
total 59 60 98.3


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2 1     1   148696 use strict;
  1         3  
  1         115  
3              
4 1     1   628 use Test::More tests => 15;
  1         20107  
  1         9  
5 1     1   1292 use Test::Exception;
  1         2771  
  1         4  
6              
7 1     1   213 use File::Basename;
  1         2  
  1         98  
8 1     1   281 use File::Spec::Functions;
  1         468  
  1         62  
9              
10 1     1   290 use lib "../lib";
  1         551  
  1         3  
11              
12 1     1   112302 use_ok("Devel::PerlySense::Document");
  1         398  
  1         3  
  1         2  
  1         12  
13 1     1   293 use_ok("Devel::PerlySense::Document::Location");
  1         82  
  1         2  
  1         1  
  1         5  
14              
15              
16 1 50   1   1527 BEGIN { -d "t" and chdir("t"); }
17              
18              
19 1         197 ok(my $oDocument = Devel::PerlySense::Document->new(oPerlySense => Devel::PerlySense->new()), "new ok");
20              
21 1         191 my $dirData = "data/simple-lib";
22 1         3 my $fileOrigin = "$dirData/lib/Win32/Word/Writer.pm";
23              
24 1         3 ok($oDocument->parse(file => $fileOrigin), "Parsed file ok");
25              
26              
27              
28 1         353 my $fragment;
29              
30              
31              
32              
33 1         8 is(scalar($oDocument->moduleAt(row => 452, col => 1)), undef, "No perl fragment ok, between stuff");
34              
35 1         201 $fragment = 'File::Temp';
36 1         5 is($oDocument->moduleAt(row => 154, col => 10), $fragment, "On use module");
37              
38              
39 1         394 $fragment = 'Win32::OLE::Const';
40 1         4 is($oDocument->moduleAt(row => 160, col => 25), $fragment, "On class method call ");
41              
42 1         187 $fragment = 'Class::MethodMaker';
43 1         3 is($oDocument->moduleAt(row => 193, col => 14), $fragment, "On use with params");
44              
45              
46 1         186 $fragment = 'Win32::Word::Writer::Table';
47 1         5 is($oDocument->moduleAt(row => 157, col => 11), $fragment, "On use");
48              
49              
50              
51 1         197 is(scalar($oDocument->moduleAt(row => 287, col => 18)), undef, "No perl fragment ok, on object->method");
52              
53 1         191 is(scalar($oDocument->moduleAt(row => 290, col => 25)), undef, "No perl fragment ok, on variable");
54              
55 1         191 is(scalar($oDocument->moduleAt(row => 288, col => 38)), undef, "No perl fragment ok, on chained method call");
56              
57 1         192 is(scalar($oDocument->moduleAt(row => 288, col => 38)), undef, "No perl fragment ok, on chained method call");
58              
59 1         190 is(scalar($oDocument->moduleAt(row => 279, col => 13)), undef, "No perl fragment ok, on self method call");
60              
61 1         191 is(scalar($oDocument->moduleAt(row => 146, col => 7)), undef, "No perl fragment ok, on use pragma");
62              
63              
64              
65             #Don't check this, we can't determine that this isn't a module by lexical method
66             #But if the module lookup fails, we could say it's something else, like a bareword sub or somehting
67              
68             #is(scalar($oDocument->moduleAt(row => 592, col => 32)), undef, "No perl fragment ok, on hash key token");
69              
70              
71              
72              
73              
74             __END__