Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit c35997ca71b820746c7a1f1d6992404984833b31 1 parent aa3d684
@kzys kzys authored
View
1  lib/Perl/Metrics/Lite/Analysis/DocumentFactory.pm
@@ -25,7 +25,6 @@ sub create_normalized_document {
}
$document = _create_ppi_document($path);
}
- $document = _make_pruned_document($document);
$document;
}
View
23 t/0050_document.t
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.