xref: /openbsd-src/gnu/usr.bin/perl/cpan/Config-Perl-V/t/10_base.t (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1#!/pro/bin/perl
2
3use strict;
4use warnings;
5
6BEGIN {
7    use Test::More;
8    my $tests = 9;
9    unless ($ENV{PERL_CORE}) {
10	require Test::NoWarnings;
11	Test::NoWarnings->import ();
12	$tests++;
13	}
14
15    plan tests => $tests;
16
17    use_ok ("Config::Perl::V");
18    }
19
20ok (my $conf = Config::Perl::V::myconfig,	"Read config");
21ok (exists $conf->{$_},	"Has $_ entry") for qw( build environment config inc );
22is (lc $conf->{build}{osname}, lc $conf->{config}{osname}, "osname");
23
24SKIP: {
25    # Test that the code that shells out to perl -V and parses the output
26    # gives the same results as the code that calls Config::* routines directly.
27    defined &Config::compile_date or
28	skip "This perl doesn't provide perl -V in the Config module", 2;
29    eval q{no warnings "redefine"; sub Config::compile_date { return undef }};
30    is (Config::compile_date (), undef, "Successfully overriden compile_date");
31    is_deeply (Config::Perl::V::myconfig, $conf,
32	"perl -V parsing code produces same result as the Config module");
33    }
34