diff options
Diffstat (limited to 't')
-rw-r--r-- | t/00-compile.t | 50 | ||||
-rw-r--r-- | t/basics.t | 32 | ||||
-rw-r--r-- | t/release-pod-coverage.t | 15 | ||||
-rw-r--r-- | t/release-pod-syntax.t | 14 |
4 files changed, 111 insertions, 0 deletions
diff --git a/t/00-compile.t b/t/00-compile.t new file mode 100644 index 0000000..391816c --- /dev/null +++ b/t/00-compile.t @@ -0,0 +1,50 @@ +use 5.006; +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.040 + +use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); + + + +my @module_files = ( + 'ExtUtils/Config.pm' +); + + + +# no fake home requested + +my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; + +use File::Spec; +use IPC::Open3; +use IO::Handle; + +open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; + +my @warnings; +for my $lib (@module_files) +{ + # see L<perlfaq8/How can I capture STDERR from an external command?> + my $stderr = IO::Handle->new; + + my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); + binmode $stderr, ':crlf' if $^O eq 'MSWin32'; + my @_warnings = <$stderr>; + waitpid($pid, 0); + is($?, 0, "$lib loaded ok"); + + if (@_warnings) + { + warn @_warnings; + push @warnings, @_warnings; + } +} + + + +is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING}; + + diff --git a/t/basics.t b/t/basics.t new file mode 100644 index 0000000..67dbaf3 --- /dev/null +++ b/t/basics.t @@ -0,0 +1,32 @@ +#!/usr/bin/perl -w + +use strict; +use warnings FATAL => 'all'; +use Test::More 0.88; + +use Config; + +use ExtUtils::Config; + +my $config = ExtUtils::Config->new; + +ok($config->exists('path_sep'), "'path_sep' is set"); +is($config->get('path_sep'), $Config{path_sep}, "'path_sep' is the same for \$Config"); + +ok(!$config->exists('nonexistent'), "'nonexistent' is still nonexistent"); + +ok(!defined $config->get('nonexistent'), "'nonexistent' is not defined"); + +is_deeply($config->all_config, \%Config, 'all_config is \%Config'); + +my $config2 = ExtUtils::Config->new({ more => 'nomore' }); +my %myconfig = (%Config, more => 'nomore'); + +is_deeply($config2->values_set, { more => 'nomore' }, 'values_set is { more => \'nomore\'}'); +is_deeply($config2->all_config, \%myconfig, 'allconfig is myconfig'); + +my $set = $config->values_set; +$set->{more} = 'more3'; +is($config->get('more'), $Config{more}, "more is still '$Config{more}'"); + +done_testing; diff --git a/t/release-pod-coverage.t b/t/release-pod-coverage.t new file mode 100644 index 0000000..18a8274 --- /dev/null +++ b/t/release-pod-coverage.t @@ -0,0 +1,15 @@ +#!perl + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for release candidate testing'); + } +} + +# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. + +use Test::Pod::Coverage 1.08; +use Pod::Coverage::TrustPod; + +all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff --git a/t/release-pod-syntax.t b/t/release-pod-syntax.t new file mode 100644 index 0000000..cdd6a6c --- /dev/null +++ b/t/release-pod-syntax.t @@ -0,0 +1,14 @@ +#!perl + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for release candidate testing'); + } +} + +# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. +use Test::More; +use Test::Pod 1.41; + +all_pod_files_ok(); |