File Coverage

t/PerlySense-Document-object-method-call.t
Criterion Covered Total %
statement 47 48 97.9
branch 1 2 50.0
condition n/a
subroutine 9 9 100.0
pod n/a
total 57 59 96.6


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2 1     1   304270 use strict;
  1         2  
  1         70  
3              
4 1     1   1560 use Test::More tests => 15;
  1         27628  
  1         9  
5 1     1   1542 use Test::Exception;
  1         4213  
  1         6  
6              
7 1     1   363 use File::Basename;
  1         7  
  1         9108  
8 1     1   680 use Data::Dumper;
  1         13148  
  1         73  
9              
10 1     1   1648 use lib "../lib";
  1         540  
  1         3  
11              
12 1     1   112166 use_ok("Devel::PerlySense::Document");
  1         5133  
  1         3  
  1         2  
  1         11  
13 1     1   296 use_ok("Devel::PerlySense::Document::Location");
  1         78  
  1         1  
  1         2  
  1         6  
14              
15              
16 1 50   1   1984 BEGIN { -d "t" and chdir("t"); }
17              
18              
19 1         2237 ok(my $oDocument = Devel::PerlySense::Document->new(oPerlySense => Devel::PerlySense->new()), "new ok");
20              
21 1         437 my $dirData = "data/project-lib";
22 1         4 my $fileOrigin = "$dirData/Game/Lawn.pm";
23              
24 1         36 ok($oDocument->parse(file => $fileOrigin), "Parsed file ok");
25              
26              
27              
28              
29              
30 1         323 my $fragment;
31              
32 1         2 $fragment = '$oObject->oLawn';
33 1         5 is($oDocument->methodCallAt(row => 219, col => 17) . "", $fragment, "Correct perl fragment ok, on method");
34              
35 1         460 my ($object, $method, $oLocationSub);
36 0         0 my (@aMethod);
37              
38 1         5 ok(($object, $method, $oLocationSub) = $oDocument->aObjectMethodCallAt(row => 219, col => 17), "aObjectMethodCallAt ok");
39 1         191 is("$object", '$oObject', " got oObject");
40 1         187 is("$method", 'oLawn', " got method");
41 1         211 like($oLocationSub->rhProperty->{source}, qr/sub placeObjectAt.*?displayObjectAt/s, " got node sub");
42              
43              
44 1         195 is_deeply(
45             [ @aMethod = $oDocument->aMethodCallOf(nameObject => $object, oLocationWithin => $oLocationSub) ],
46             [qw/ oLawn raBodyLocation /],
47             "Found the correct method calls in the sub");
48              
49              
50 1         446 ok(($object, $method, $oLocationSub) = $oDocument->aObjectMethodCallAt(row => 572, col => 16), "aObjectMethodCallAt ok");
51 1         232 is("$object", '$oObject', " got oObject");
52 1         225 is("$method", 'oLawn', " got method");
53 1         213 like($oLocationSub->rhProperty->{source}, qr/END.*?oLawn/s, " got node sub");
54              
55              
56 1         194 is_deeply(
57             [ @aMethod = $oDocument->aMethodCallOf(nameObject => $object, oLocationWithin => $oLocationSub) ],
58             [qw/ oLawn /],
59             "Found the correct method calls in the sub");
60              
61              
62              
63              
64              
65              
66              
67             __END__