| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | #!/usr/bin/perl -w | 
| 2 | 1 |  |  | 1 |  | 102288 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 64 |  | 
| 3 |  |  |  |  |  |  |  | 
| 4 | 1 |  |  | 1 |  | 507 | use Test::More tests => 31; | 
|  | 1 |  |  |  |  | 17524 |  | 
|  | 1 |  |  |  |  | 8 |  | 
| 5 | 1 |  |  | 1 |  | 752 | use Test::Exception; | 
|  | 1 |  |  |  |  | 2890 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 1 |  |  | 1 |  | 599 | use Data::Dumper; | 
|  | 1 |  |  |  |  | 5214 |  | 
|  | 1 |  |  |  |  | 42 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 1 |  |  | 1 |  | 276 | use lib "../lib"; | 
|  | 1 |  |  |  |  | 561 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 1 |  |  | 1 |  | 71367 | use_ok("Devel::PerlySense"); | 
|  | 1 |  |  |  |  | 672 |  | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 13 | 1 |  |  | 1 |  | 286 | use_ok("Devel::PerlySense::Class"); | 
|  | 1 |  |  |  |  | 78 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 1 | 50 |  | 1 |  | 2505 | BEGIN { -d "t" and chdir("t"); } | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | throws_ok( | 
| 20 | 1 |  |  | 1 |  | 32 | sub { Devel::PerlySense::Class->new( | 
| 21 |  |  |  |  |  |  | oPerlySense => Devel::PerlySense->new(), | 
| 22 |  |  |  |  |  |  | ) }, | 
| 23 | 1 |  |  |  |  | 200 | qr/name/, | 
| 24 |  |  |  |  |  |  | "new fails ok with missing name", | 
| 25 |  |  |  |  |  |  | ); | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | lives_ok( | 
| 28 | 1 |  |  | 1 |  | 17 | sub { Devel::PerlySense::Class->new( | 
| 29 |  |  |  |  |  |  | oPerlySense => Devel::PerlySense->new(), | 
| 30 |  |  |  |  |  |  | name => "dummy", | 
| 31 |  |  |  |  |  |  | raDocument => [], | 
| 32 |  |  |  |  |  |  | ) }, | 
| 33 | 1 |  |  |  |  | 769 | "new ok with name", | 
| 34 |  |  |  |  |  |  | ); | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | throws_ok( | 
| 41 |  |  |  |  |  |  | sub { | 
| 42 | 1 |  |  | 1 |  | 17 | Devel::PerlySense::Class->newFromFileAt( | 
| 43 |  |  |  |  |  |  | oPerlySense => Devel::PerlySense->new(), | 
| 44 |  |  |  |  |  |  | file => "lost_file.pm", | 
| 45 |  |  |  |  |  |  | row => 1, | 
| 46 |  |  |  |  |  |  | col => 1, | 
| 47 |  |  |  |  |  |  | ) | 
| 48 |  |  |  |  |  |  | }, | 
| 49 | 1 |  |  |  |  | 197 | qr/Could not parse file .lost_file.pm/, | 
| 50 |  |  |  |  |  |  | "newFromFileAt dies ok with missing file", | 
| 51 |  |  |  |  |  |  | ); | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 1 |  |  |  |  | 397 | my $dirData = "data/project-lib"; | 
| 57 | 1 |  |  |  |  | 3 | my $fileOrigin = "$dirData/Game/Object/Worm/ShaiHulud.pm"; | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 1 |  |  |  |  | 5 | ok( | 
| 61 |  |  |  |  |  |  | my $oClassDefault = Devel::PerlySense::Class->newFromFileAt( | 
| 62 |  |  |  |  |  |  | oPerlySense => Devel::PerlySense->new(), | 
| 63 |  |  |  |  |  |  | file => $fileOrigin, | 
| 64 |  |  |  |  |  |  | row => 1, | 
| 65 |  |  |  |  |  |  | col => 1, | 
| 66 |  |  |  |  |  |  | ), | 
| 67 |  |  |  |  |  |  | "newFromFileAt at main finds default package ok", | 
| 68 |  |  |  |  |  |  | ); | 
| 69 | 1 |  |  |  |  | 314 | is($oClassDefault->name, "Game::Object::Worm::ShaiHulud", "  with correct class name"); | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  |  | 
| 72 | 1 |  |  |  |  | 195 | ok( | 
| 73 |  |  |  |  |  |  | my $oClassOjectWormShai = Devel::PerlySense::Class->newFromFileAt( | 
| 74 |  |  |  |  |  |  | oPerlySense => Devel::PerlySense->new(), | 
| 75 |  |  |  |  |  |  | file => $fileOrigin, | 
| 76 |  |  |  |  |  |  | row => 20, | 
| 77 |  |  |  |  |  |  | col => 1, | 
| 78 |  |  |  |  |  |  | ), | 
| 79 |  |  |  |  |  |  | "newFromFileAt at proper package location ok", | 
| 80 |  |  |  |  |  |  | ); | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  |  | 
| 83 | 1 |  |  |  |  | 289 | note("Game::Object::Worm::ShaiHulud"); | 
| 84 | 1 |  |  |  |  | 48 | isa_ok($oClassOjectWormShai, "Devel::PerlySense::Class"); | 
| 85 | 1 |  |  |  |  | 265 | is($oClassOjectWormShai->name, "Game::Object::Worm::ShaiHulud", "  Got correct class name"); | 
| 86 |  |  |  |  |  |  |  | 
| 87 | 1 |  |  |  |  | 201 | is(scalar @{$oClassOjectWormShai->raDocument}, 1, "  Has one Document"); | 
|  | 1 |  |  |  |  | 27 |  | 
| 88 | 1 |  |  |  |  | 213 | ok(my $oDocumentOjectWormShai = $oClassOjectWormShai->raDocument->[0], "    Got document"); | 
| 89 | 1 |  |  |  |  | 213 | like($oDocumentOjectWormShai->file, qr|Game.Object.Worm.ShaiHulud.pm$|, "    Document file ok"); | 
| 90 |  |  |  |  |  |  |  | 
| 91 | 1 |  |  |  |  | 26 | is_deeply( | 
| 92 | 1 |  |  |  |  | 189 | [ sort keys %{$oClassOjectWormShai->rhClassBase} ], | 
| 93 |  |  |  |  |  |  | [ "Game::Lawn", "Game::Object::Worm" ], | 
| 94 |  |  |  |  |  |  | "  Has the correct base classes", | 
| 95 |  |  |  |  |  |  | ); | 
| 96 |  |  |  |  |  |  |  | 
| 97 | 1 |  |  |  |  | 441 | ok(my $oClassLawn = $oClassOjectWormShai->rhClassBase->{"Game::Lawn"}, "  Got Lawn"); | 
| 98 | 1 |  |  |  |  | 214 | ok(my $oClassGameObjectWorm = $oClassOjectWormShai->rhClassBase->{"Game::Object::Worm"}, "  Got Worm"); | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  |  | 
| 103 | 1 |  |  |  |  | 187 | note("Game::Object::Worm"); | 
| 104 | 1 |  |  |  |  | 37 | isa_ok($oClassGameObjectWorm, "Devel::PerlySense::Class"); | 
| 105 | 1 |  |  |  |  | 258 | is($oClassGameObjectWorm->name, "Game::Object::Worm", "  Got correct class name"); | 
| 106 |  |  |  |  |  |  |  | 
| 107 | 1 |  |  |  |  | 190 | is(scalar @{$oClassGameObjectWorm->raDocument}, 1, "  Has one Document"); | 
|  | 1 |  |  |  |  | 25 |  | 
| 108 | 1 |  |  |  |  | 211 | ok(my $oDocumentGameObjectWorm = $oClassGameObjectWorm->raDocument->[0], "    Got document"); | 
| 109 | 1 |  |  |  |  | 211 | like($oDocumentGameObjectWorm->file, qr|Game.Object.Worm.pm$|, "    Document file ok"); | 
| 110 |  |  |  |  |  |  |  | 
| 111 | 1 |  |  |  |  | 27 | is_deeply( | 
| 112 | 1 |  |  |  |  | 190 | [ sort keys %{$oClassGameObjectWorm->rhClassBase} ], | 
| 113 |  |  |  |  |  |  | [ "Game::Object" ], | 
| 114 |  |  |  |  |  |  | "  Has the correct base classes", | 
| 115 |  |  |  |  |  |  | ); | 
| 116 |  |  |  |  |  |  |  | 
| 117 | 1 |  |  |  |  | 402 | ok(my $oClassGameObjectFromWorm = $oClassGameObjectWorm->rhClassBase->{"Game::Object"}, "  Got Game::Object"); | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  |  | 
| 123 | 1 |  |  |  |  | 190 | note("Game::Lawn"); | 
| 124 | 1 |  |  |  |  | 37 | isa_ok($oClassLawn, "Devel::PerlySense::Class"); | 
| 125 | 1 |  |  |  |  | 243 | is($oClassLawn->name, "Game::Lawn", "  Got correct class name"); | 
| 126 |  |  |  |  |  |  |  | 
| 127 | 1 |  |  |  |  | 189 | is(scalar @{$oClassLawn->raDocument}, 1, "  Has one Document"); | 
|  | 1 |  |  |  |  | 26 |  | 
| 128 | 1 |  |  |  |  | 210 | ok(my $oDocumentLawn = $oClassLawn->raDocument->[0], "    Got document"); | 
| 129 | 1 |  |  |  |  | 213 | like($oDocumentLawn->file, qr|Game.Lawn.pm$|, "    Document file ok"); | 
| 130 |  |  |  |  |  |  |  | 
| 131 | 1 |  |  |  |  | 27 | is_deeply( | 
| 132 | 1 |  |  |  |  | 186 | [ sort keys %{$oClassLawn->rhClassBase} ], | 
| 133 |  |  |  |  |  |  | [ "Game::Object" ], | 
| 134 |  |  |  |  |  |  | "  Has the correct base classes", | 
| 135 |  |  |  |  |  |  | ); | 
| 136 |  |  |  |  |  |  |  | 
| 137 | 1 |  |  |  |  | 444 | ok(my $oClassGameObjectFromLawn = $oClassLawn->rhClassBase->{"Game::Object"}, "  Got Object"); | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  |  | 
| 141 | 1 |  |  |  |  | 190 | note("Game::Object"); | 
| 142 | 1 |  |  |  |  | 34 | is($oClassGameObjectFromLawn, $oClassGameObjectFromWorm, "Game::Object class are the same"); | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | # is_deeply([ sort $oClass->aNameModuleUse() ], | 
| 149 |  |  |  |  |  |  | #           [ sort qw/ | 
| 150 |  |  |  |  |  |  | #                     Data::Dumper | 
| 151 |  |  |  |  |  |  | #                     Game::Location | 
| 152 |  |  |  |  |  |  | #                     Game::Direction | 
| 153 |  |  |  |  |  |  | #                     Game::Event::Timed | 
| 154 |  |  |  |  |  |  | #                     Exception::Class | 
| 155 |  |  |  |  |  |  | #                     Class::MethodMaker | 
| 156 |  |  |  |  |  |  | #                     / ], "Found used modules ok"); | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | __END__ |