File: get_from_file.t

package info (click to toggle)
libtest-prereq-perl 2.005-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 216 kB
  • sloc: perl: 266; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 786 bytes parent folder | download | duplicates (4)
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
use Test::More 0.95;

use Test::Prereq;

my @prereq_files = sort qw(
	Carp
	ExtUtils::MakeMaker
	File::Find
	Module::Extract::Use
	Test::Builder::Module
	feature
	parent
	strict
	vars
	warnings
	utf8
	);

my @tests = (
	[ 't/pod.t',            [ qw(Test::More) ]  ],
	[ 'lib/Test/Prereq.pm', [ @prereq_files ]   ],
	);

foreach my $test ( @tests ) {
	my( $file, $expected ) = @$test;

	@$expected = sort @$expected;

	subtest pod => sub {
		my @modules = sort @{ from_file( $file ) };

		diag "Did not find right modules for $file!\nFound <@modules>\n"
			unless is_deeply( \@modules, $expected,
					"Found the expected modules for $file"
					);
		};
	}

sub from_file {
	my( $file ) = @_;

	my $modules = Test::Prereq->_get_from_file( $file );

	return $modules;
	}

done_testing();