File Coverage

t/PerlySense-Document-package.t
Criterion Covered Total %
statement 44 44 100.0
branch 1 2 50.0
condition n/a
subroutine 12 12 100.0
pod n/a
total 57 58 98.2


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2 1     1   173342 use strict;
  1         2  
  1         64  
3              
4 1     1   505 use Test::More tests => 15;
  1         20756  
  1         10  
5 1     1   1555 use Test::Exception;
  1         2586  
  1         4  
6              
7 1     1   210 use File::Basename;
  1         1  
  1         99  
8 1     1   269 use File::Spec::Functions;
  1         458  
  1         60  
9              
10 1     1   267 use lib "../lib";
  1         538  
  1         3  
11              
12 1     1   138753 use_ok("Devel::PerlySense::Document");
  1         379  
  1         3  
  1         2  
  1         8  
13              
14              
15 1 50   1   1589 BEGIN { -d "t" and chdir("t"); }
16              
17              
18 1         289 ok(my $oDocument = Devel::PerlySense::Document->new(oPerlySense => Devel::PerlySense->new()), "new ok");
19 1         223 is($oDocument->file, "", " file is ok");
20 1         217 is($oDocument->oDocument, undef, " oDocument is ok");
21              
22 1     1   206 throws_ok( sub { $oDocument->parse() }, qr/Missing argument \(file\)/, "Parse died ok on missing param");
  1         40  
23              
24 1     1   1323 dies_ok( sub { $oDocument->parse(file => "sldkfjsd/missing/sldkfjs.pm") }, "Parse died ok on missing file");
  1         18  
25 1         34836 is($oDocument->file, "", " file is ok");
26 1         325 is($oDocument->oDocument, undef, " oDocument is ok");
27              
28              
29              
30 1         201 my $dirData = "data/simple-lib";
31 1         4 my $fileOrigin = "$dirData/lib/Win32/Word/Writer/Table.pm";
32              
33 1         8 ok($oDocument->parse(file => $fileOrigin), "Parsed file ok");
34 1         378 is($oDocument->file, $fileOrigin, " file set ok");
35 1         216 isnt($oDocument->oDocument, undef, " oDocument is ok");
36              
37 1         218 is($oDocument->packageAt(row => 1), "main", "Correct package main ok");
38              
39 1         194 is($oDocument->packageAt(row => 143), "Win32::Word::Writer::Table", "Correct package Table ok");
40              
41 1     1   213 throws_ok(sub { $oDocument->packageAt(row => 0) }, qr/row/, "Dies ok when outside document");
  1         34  
42 1     1   646 throws_ok(sub { $oDocument->packageAt(row => -1) }, qr/row/, "Dies ok when outside document");
  1         17  
43              
44              
45              
46              
47              
48             __END__