File: 27_complete.t

package info (click to toggle)
libppi-perl 1.236-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,056 kB
  • ctags: 922
  • sloc: perl: 15,002; makefile: 8
file content (38 lines) | stat: -rwxr-xr-x 1,059 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
#!/usr/bin/perl

# Testing for the PPI::Document ->complete method

use lib 't/lib';
use PPI::Test::pragmas;
use Test::More; # Plan comes later

use File::Spec::Functions ':ALL';
use PPI;
use PPI::Test 'find_files';

# This test uses a series of ordered files, containing test code.
# The letter after the number acts as a boolean yes/no answer to
# "Is this code complete"
my @files = find_files( catdir( 't', 'data', '27_complete' ) );
my $tests = (scalar(@files) * 2) + 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
plan( tests => $tests );





#####################################################################
# Resource Location

ok( scalar(@files), 'Found at least one ->complete test file' );
foreach my $file ( @files ) {
	# Load the document
	my $document = PPI::Document->new( $file );
	isa_ok( $document, 'PPI::Document' );

	# Test if complete or not
	my $got      = !! ($document->complete);
	my $expected = !! ($file =~ /\d+y\w+\.code$/);
	my $isnot    = ($got == $expected) ? 'is' : 'is NOT';
	is( $got, $expected, "File $file $isnot complete" );
}