File Coverage

t/PerlySense-Class-neighbourhood.t
Criterion Covered Total %
statement 40 40 100.0
branch 1 2 50.0
condition n/a
subroutine 8 8 100.0
pod n/a
total 49 50 98.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2 1     1   102537 use strict;
  1         1  
  1         59  
3              
4 1     1   462 use Test::More tests => 8;
  1         14799  
  1         8  
5 1     1   682 use Test::Exception;
  1         2564  
  1         3  
6              
7 1     1   595 use Data::Dumper;
  1         5221  
  1         45  
8              
9              
10 1     1   275 use lib "../lib";
  1         519  
  1         3  
11              
12 1     1   70306 use_ok("Devel::PerlySense");
  1         603  
  1         2  
  1         2  
  1         6  
13 1     1   276 use_ok("Devel::PerlySense::Class");
  1         79  
  1         1  
  1         1  
  1         7  
14              
15              
16 1 50   1   1534 BEGIN { -d "t" and chdir("t"); }
17              
18              
19              
20 1         197 my $dirData = "data/project-lib";
21 1         3 my $dirOrigin = "$dirData/Game/Object";
22 1         2 my $fileOrigin = "$dirOrigin/Worm.pm";
23              
24 1         4 ok(
25             my $oClassOject = Devel::PerlySense::Class->newFromFileAt(
26             oPerlySense => Devel::PerlySense->new(),
27             file => $fileOrigin,
28             row => 20,
29             col => 1,
30             ),
31             "newFromFileAt at proper package location ok",
32             );
33              
34              
35 1         345 note("Classes in ($dirOrigin)");
36 1         51 is_deeply(
37             [ sort $oClassOject->aNameClassInDir(dir => $dirOrigin) ],
38             [ sort qw/
39             Game::Object::Worm
40             Game::Object::WormVisible
41             Game::Object::Prize
42             Game::Object::Wall
43             /],
44             "Classes in dir found correct classes",
45             );
46              
47              
48              
49 1         566 note("Classes in the neighbourhood of ($fileOrigin)");
50              
51 1         52 ok(
52             my $rhDirClass = $oClassOject->rhDirNameClassInNeighbourhood(),
53             "rhDirNameClassInNeighbourhood ok",
54             );
55              
56              
57 1         11 is_deeply(
58 1         781 [ sort @{$rhDirClass->{current}} ],
59             [ sort qw/
60             Game::Object::Worm
61             Game::Object::WormVisible
62             Game::Object::Prize
63             Game::Object::Wall
64             /],
65             "Classes in current dir found correct classes",
66             );
67              
68 1         11 is_deeply(
69 1         438 [ sort @{$rhDirClass->{up}} ],
70             [ sort qw/
71             Game::ObjectVisible
72             Game::Application
73             Game::Controller
74             Game::Direction
75             Game::Lawn
76             Game::Location
77             Game::Object
78             Game::UI
79             /],
80             "Classes in up dir found correct classes",
81             );
82              
83 1         7 is_deeply(
84 1         401 [ sort @{$rhDirClass->{down}} ],
85             [ sort qw/
86             Game::Object::Worm::Bot
87             Game::Object::Worm::Shaitan
88             Game::Object::Worm::ShaiHulud
89             /],
90             "Classes in up dir found correct classes",
91             );
92              
93              
94              
95              
96              
97             __END__