PPIx-EditorTools
view release on metacpan or search on metacpan
t/09-outline.t view on Meta::CPAN
#!/usr/bin/perl
use strict;
BEGIN {
$^W = 1;
}
use Test::More;
use Test::Differences;
use PPI;
use PPIx::EditorTools::Outline;
BEGIN {
if ( $PPI::VERSION =~ /_/ ) {
plan skip_all => "Need released version of PPI. You have $PPI::VERSION";
exit 0;
}
}
my @cases = (
{ file => 't/outline/Foo.pm',
expected => [
{ 'modules' => [
{ name => 'Method::Signatures',
line => 3,
},
],
'methods' => [
{ name => 'new',
line => 5,
},
{ name => 'hello',
line => 8,
}
],
'line' => 1,
'name' => 'Foo',
}
],
},
{ file => 't/outline/file1.pl',
expected => [
{ 'methods' => [
{ 'line' => 6,
'name' => 'qwer'
}
],
'modules' => [
{ 'line' => 2,
'name' => 'Abc'
}
],
'name' => 'main',
'pragmata' => [
{ 'line' => 1,
'name' => 'strict'
},
{ 'line' => 1,
'name' => 'warnings'
}
]
}
],
},
{ code => <<'END_CODE',
use strict;
END_CODE
expected => [
{ 'pragmata' => [
( run in 0.578 second using v1.01-cache-2.11-cpan-99c4e6809bf )