File: ppi_statement_package.t

package info (click to toggle)
libppi-perl 1.215-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,820 kB
  • sloc: perl: 12,129; makefile: 8
file content (43 lines) | stat: -rw-r--r-- 948 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl

# Unit testing for PPI, generated by Test::Inline

use strict;
use File::Spec::Functions ':ALL';
BEGIN {
	$|  = 1;
	$^W = 1;
	no warnings 'once';
	$PPI::XS_DISABLE = 1;
	$PPI::Lexer::X_TOKENIZER ||= $ENV{X_TOKENIZER};
}
use PPI;

# Execute the tests
use Test::More tests => 2;

# =begin testing hash_constructors_dont_contain_packages_rt52259 2
{
my $Document = PPI::Document->new(\<<'END_PERL');
{    package  => "", };
+{   package  => "", };
{   'package' => "", };
+{  'package' => "", };
{   'package' ,  "", };
+{  'package' ,  "", };
END_PERL

isa_ok( $Document, 'PPI::Document' );

my $packages = $Document->find('PPI::Statement::Package');
my $test_name = 'Found no package statements in hash constructors - RT #52259';
if (not $packages) {
	pass $test_name;
} elsif ( not is(scalar @{$packages}, 0, $test_name) ) {
	diag 'Package statements found:';
	diag $_->parent()->parent()->content() foreach @{$packages};
}
}


1;