File: 1.get_test_files.t

package info (click to toggle)
libtest-manifest-perl 1.14-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 96 kB
  • ctags: 7
  • sloc: perl: 78; makefile: 35
file content (83 lines) | stat: -rw-r--r-- 2,334 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# $Id: 1.get_test_files.t,v 1.7 2005/03/27 02:29:36 comdog Exp $
use strict;

use Test::More tests => 13;

use File::Copy qw(copy);
use File::Spec;

use Test::Manifest qw(get_t_files manifest_name);

copy( 'test_manifest', manifest_name() );

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
my $expected = join " ", map { File::Spec->catfile( "t", $_ ) } qw(
		0.load.t 1.get_test_files.t 1.make_test_manifest.t
		leading_space.t trailing_space.t
		);

my @tests = split /\s+/, $expected;

my $string = get_t_files();

is( $string, $expected, "Single string version of tests is right" );

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
my @array = get_t_files();

foreach my $i ( 0 .. $#array )
	{
	is( $array[$i], $tests[$i], "Test file $i has expected name" );
	}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
{
local $SIG{__WARN__} = sub { 1 };

( unlink manifest_name() ) ? 
	pass( "test_manifest unlinked") : 
	fail( "test_manifest still around after unlink!");

my $string = get_t_files();

ok( ! $string, "Nothing returned when test_manifest does not exist (scalar)" );

my @array = get_t_files();

ok( ! $string, "Nothing returned when test_manifest does not exist (list)" );
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
{
local $Test::Harness::verbose = 1;
copy( 'test_manifest_levels', manifest_name() );

my @expected = ( [] );
$expected[1] = [ qw( 0.load.t 1.get_test_files.t pod_coverage.t) ];
$expected[2] = [ qw( 0.load.t 1.get_test_files.t 1.make_test_manifest.t 
	pod_coverage.t ) ];
$expected[3] = [ qw( 0.load.t 1.get_test_files.t 1.make_test_manifest.t 
	leading_space.t pod_coverage.t trailing_space.t ) ];
$expected[0] = [ qw( 0.load.t 1.get_test_files.t 1.make_test_manifest.t 
	leading_space.t pod_coverage.t trailing_space.t 99.pod.t ) ];
	
foreach my $level ( 0 .. 3 )
	{
	my $string = get_t_files( $level );
	my $expected = join ' ', map { File::Spec->catfile( 't', $_ ) } 
		@{ $expected[$level] };
	is( $string, $expected, "Level $level version of tests is right" );
	}

}

__END__
# this is a comment, then a blank line

0.load.t
1.get_test_files.t 1 
1.make_test_manifest.t 2
leading_space.t 2.9
pod_coverage.t 1 # with a comment
trailing_space.t 3 # with a comment
99.pod.t	3.1