X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F011_version_options.t;h=f8f5a6844a2ed5b93ca57e1bae637aeb29515760;hb=refs%2Fheads%2Fversion_handling;hp=2385ebbb4392fb43c4264f0d87210fedf5f89166;hpb=646e95a0ee84424d8124e240ce36fd0275264cb3;p=gitmo%2FMooseX-Getopt.git diff --git a/t/011_version_options.t b/t/011_version_options.t index 2385ebb..f8f5a68 100644 --- a/t/011_version_options.t +++ b/t/011_version_options.t @@ -1,9 +1,13 @@ use strict; use warnings; -use Capture::Tiny 'capture'; use File::Spec::Functions 'catfile'; use Test::More; +BEGIN { + eval "use Capture::Tiny 'capture'"; + plan skip_all => "Capture::Tiny unavailable" if $@; +} + my $HAVE_SIMPLECONFIG = eval { require MooseX::SimpleConfig; return 1; @@ -20,16 +24,20 @@ for my $opt (qw(-v --version -V)) { for my $test (qw(version_with_options.pl version_with_simpleconfig.pl)) { my $script = catfile('t', $test); - next if $test eq 'version_with_simpleconfig.pl' && !$HAVE_SIMPLECONFIG; + SKIP: { + if ($test eq 'version_with_simpleconfig.pl' && !$HAVE_SIMPLECONFIG) { + skip('MooseX::SimpleConfig unavailable', 3); + } - my ($v, undef) = capture { system $^X, $script, '-v' }; - like($v, qr/^SUCCESS/, "Option -v is correct"); + my ($v, undef) = capture { system $^X, $script, '-v' }; + like($v, qr/^SUCCESS/, "Option -v is correct"); - my ($version, undef) = capture { system $^X, $script, '--version' }; - like($version, qr/^SUCCESS/, "Option --version is correct"); + my ($version, undef) = capture { system $^X, $script, '--version' }; + like($version, qr/^SUCCESS/, "Option --version is correct"); - my (undef, $V) = capture { system $^X, $script, '-V' }; - like($V, qr/^Unknown option/, "Option -V is unknown"); + my (undef, $V) = capture { system $^X, $script, '-V' }; + like($V, qr/^Unknown option/, "Option -V is unknown"); + } } done_testing();