Permalink
Browse files

Don't modify the line number of subroutines

For this purpose, create_normalized_document must not remove PODs and comments.
  • Loading branch information...
1 parent aa3d684 commit c35997ca71b820746c7a1f1d6992404984833b31 @kzys kzys committed Feb 7, 2012
Showing with 23 additions and 1 deletion.
  1. +0 −1 lib/Perl/Metrics/Lite/Analysis/DocumentFactory.pm
  2. +23 −0 t/0050_document.t
@@ -25,7 +25,6 @@ sub create_normalized_document {
}
$document = _create_ppi_document($path);
}
- $document = _make_pruned_document($document);
$document;
}
View
@@ -0,0 +1,23 @@
+use strict;
+use warnings;
+use File::Spec qw();
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+use Perl::Metrics::Lite::Analysis::DocumentFactory;
+use Test::More;
+
+Readonly::Scalar my $TEST_DIRECTORY => "$Bin/test_files";
+
+subtest create_normalized_document => sub {
+ my $path = File::Spec->join( $TEST_DIRECTORY, 'subs_no_package.pl' );
+ my $document = Perl::Metrics::Lite::Analysis::DocumentFactory
+ ->create_normalized_document( $path );
+
+ my $sub_elements = $document->find('PPI::Statement::Sub');
+ is($sub_elements->[0]->name, 'foo');
+ is($sub_elements->[0]->line_number, 17);
+
+ done_testing;
+};
+
+done_testing;

0 comments on commit c35997c

Please sign in to comment.