diff options
author | Steve Hay <SteveHay@planit.com> | 2008-09-30 12:41:16 +0000 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2008-09-30 12:41:16 +0000 |
commit | d1ef72e8d5ca14e2484958daf12a72d6ccd2187f (patch) | |
tree | 11af17b5afb4e09b11441276093886e0bef603b1 | |
parent | c1c8b72b4c9124b922ffb705ef671f9ce9a9104c (diff) | |
download | perl-d1ef72e8d5ca14e2484958daf12a72d6ccd2187f.tar.gz |
Add the two new test files that I missed in 34446
(Thanks to Rafael for the spot)
p4raw-id: //depot/perl@34448
-rw-r--r-- | lib/Module/Build/t/test_file_exts.t | 45 | ||||
-rw-r--r-- | lib/Module/Build/t/use_tap_harness.t | 61 |
2 files changed, 106 insertions, 0 deletions
diff --git a/lib/Module/Build/t/test_file_exts.t b/lib/Module/Build/t/test_file_exts.t new file mode 100644 index 0000000000..54614d18ef --- /dev/null +++ b/lib/Module/Build/t/test_file_exts.t @@ -0,0 +1,45 @@ +#!/usr/bin/perl -w + +use strict; +use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib'; +use MBTest tests => 5; +use DistGen; + +use_ok 'Module::Build'; +ensure_blib('Module::Build'); + +my $tmp = MBTest->tmpdir; +my $dist = DistGen->new( dir => $tmp ); + +$dist->add_file('t/mytest.s', <<'---' ); +#!perl +use Test::More tests => 2; +ok(1, 'first mytest.s'); +ok(1, 'second mytest.s'); +--- + +$dist->regen; +$dist->chdir_in; + +######################### + +# So make sure that the test gets run with the alternate extension. +ok my $mb = Module::Build->new( + module_name => $dist->name, + test_file_exts => ['.s'], + quiet => 1, +), 'Construct build object with test_file_exts parameter'; + +$mb->add_to_cleanup('save_out'); +# Use uc() so we don't confuse the current test output +my $out = uc(stdout_of( + sub {$mb->dispatch('test', verbose => 1)} +)); + +like $out, qr/^OK 1 - FIRST MYTEST[.]S/m, 'Should see first test output'; +like $out, qr/^OK 2 - SECOND MYTEST[.]S/m, 'Should see second test output'; + +# Cleanup. +$dist->remove; + +# vim:ts=4:sw=4:et:sta diff --git a/lib/Module/Build/t/use_tap_harness.t b/lib/Module/Build/t/use_tap_harness.t new file mode 100644 index 0000000000..b6d05989ed --- /dev/null +++ b/lib/Module/Build/t/use_tap_harness.t @@ -0,0 +1,61 @@ +#!/usr/bin/perl -w + +use strict; +use Test::More; +use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib'; +if (eval { require TAP::Parser }) { + plan tests => 8; +} else { + plan skip_all => 'TAP::Parser not installed' +} + +use MBTest; +use DistGen; + +use_ok 'Module::Build'; +ensure_blib('Module::Build'); +my $tmp = MBTest->tmpdir; +my $dist = DistGen->new( dir => $tmp ); +$dist->regen; + +$dist->chdir_in; +######################### + +# Make sure that TAP::Harness properly does its thing. +ok my $mb = Module::Build->new( + module_name => $dist->name, + use_tap_harness => 1, + quiet => 1, +), 'Construct build object with test_file_exts parameter'; + +$mb->add_to_cleanup('save_out'); +# Use uc() so we don't confuse the current test output +my $out = uc(stdout_of( + sub {$mb->dispatch('test', verbose => 1)} +)); + +like $out, qr/^OK 1/m, 'Should see first test output'; +like $out, qr/^ALL TESTS SUCCESSFUL/m, 'Should see test success message'; + +######################### + +# Make sure that arguments are passed through to TAP::Harness. +ok $mb = Module::Build->new( + module_name => $dist->name, + use_tap_harness => 1, + tap_harness_args => { verbosity => 0 }, + quiet => 1, +), 'Construct build object with test_file_exts parameter'; + +$mb->add_to_cleanup('save_out'); +# Use uc() so we don't confuse the current test output +$out = uc(stdout_of( + sub {$mb->dispatch('test', verbose => 1)} +)); + +unlike $out, qr/^OK 1/m, 'Should not see first test output'; +like $out, qr/^ALL TESTS SUCCESSFUL/m, 'Should see test success message'; + +$dist->remove; + +# vim:ts=4:sw=4:et:sta |