File: 03-perlprov.t

package info (click to toggle)
libb-perlreq-perl 0.82-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 700 kB
  • ctags: 909
  • sloc: perl: 1,090; sh: 69; makefile: 11
file content (54 lines) | stat: -rw-r--r-- 1,555 bytes parent folder | download | duplicates (5)
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
use Test::More qw(no_plan);
use strict;

use Config qw(%Config);
use Fcntl qw(F_SETFD);

sub spawn ($) {
	my $file = shift;
	open my $pipe, "-|", $^X, qw(-Mblib perl.prov) => $file
		or return (undef, undef);
	my $output = join '' => <$pipe>;
	return (close($pipe), $output);
}

sub grok ($) {
	my $file = shift;
	fcntl(STDERR, F_SETFD, 1);
	my ($ok, $output) = spawn($file);
	if (not $ok) {
		fcntl(STDERR, F_SETFD, 0);
		spawn($file);
	}
	chomp $output;
	$output =~ s/\s+/ /g;
	return $output;
}

sub Provides ($$) {
	my ($f, $expected) = @_;
	require $f;
	my $got = grok $INC{$f};
	like $got, qr/^\Q$expected\E(\d|$)/, "$f dependencies";
	ok $? == 0, "$f zero exit status";
}

my ($lib, $arch) = @Config{qw{installprivlib installarchlib}};

# Valid for perl-5.8.0 - perl-5.16.1.
Provides "attributes.pm"	=> "perl(attributes.pm) = 0.";
Provides "AutoLoader.pm"	=> "perl(AutoLoader.pm) = 5.";
Provides "base.pm"		=> "perl(base.pm) = ";
Provides "constant.pm"		=> "perl(constant.pm) = 1.";
Provides "Exporter.pm"		=> "perl(Exporter.pm) = 5.";
Provides "fields.pm"		=> "perl(fields.pm) = ";
Provides "File/Basename.pm" 	=> "perl(File/Basename.pm) = 2.";
Provides "Getopt/Long.pm"	=> "perl(Getopt/Long.pm) = 2.";
Provides "dumpvar.pl"		=> "perl(dumpvar.pl)";
Provides "Cwd.pm"		=> "perl(Cwd.pm) = ";
Provides "Data/Dumper.pm"	=> "perl(Data/Dumper.pm) = 2.";
Provides "IO/File.pm"		=> "perl(IO/File.pm) = 1.";
Provides "File/Glob.pm"		=> "perl(File/Glob.pm) = ";
Provides "Socket.pm"		=> "perl(Socket.pm) = ";
Provides "POSIX.pm"		=> "perl(POSIX.pm) = 1.";