From: Tomas Doran (t0m) Date: Tue, 9 Feb 2010 03:49:00 +0000 (+0000) Subject: Revert "Add test for strange --version handling" X-Git-Tag: 0.27~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c56feb6de4e53f87dce0cb79d81e21e15a350870;p=gitmo%2FMooseX-Getopt.git Revert "Add test for strange --version handling" This reverts commit a7474a4d90cfad550ba39acfc73d6fb972441de7. --- diff --git a/ChangeLog b/ChangeLog index c638065..7f63092 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,5 @@ Revision history for Perl extension MooseX-Getopt -0.27 - * Test suite: - - Add t/011_version_options.t for testing if -v/--version/-V are handled - correctly - 0.26 Thu. Dec 10 2009 * MooseX::Getopt::Basic - Fix bug with attribute names containing upper case letters. diff --git a/Makefile.PL b/Makefile.PL index ee89114..d3b9e47 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -21,7 +21,6 @@ requires 'Getopt::Long::Descriptive' => '0.077'; build_requires 'Test::Moose'; build_requires 'Test::More' => '0.62'; build_requires 'Test::Exception' => '0.21'; -build_requires 'Capture::Tiny' => '0'; author_requires 'Test::Pod' => 1.14; author_requires 'Test::Pod::Coverage' => '1.04'; diff --git a/t/011_version_options.t b/t/011_version_options.t deleted file mode 100644 index 2385ebb..0000000 --- a/t/011_version_options.t +++ /dev/null @@ -1,35 +0,0 @@ -use strict; -use warnings; -use Capture::Tiny 'capture'; -use File::Spec::Functions 'catfile'; -use Test::More; - -my $HAVE_SIMPLECONFIG = eval { - require MooseX::SimpleConfig; - return 1; -}; - -# none of the options should be known -for my $opt (qw(-v --version -V)) { - my $script = catfile('t', 'version_no_options.pl'); - my (undef, $stderr) = capture { system $^X, $script, $opt }; - like($stderr, qr/^Unknown option/, "Option $opt is unknown"); -} - -# only -V should be unknown, the other two should return our custom string -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; - - 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 (undef, $V) = capture { system $^X, $script, '-V' }; - like($V, qr/^Unknown option/, "Option -V is unknown"); -} - -done_testing(); diff --git a/t/version_no_options.pl b/t/version_no_options.pl deleted file mode 100644 index 73b6289..0000000 --- a/t/version_no_options.pl +++ /dev/null @@ -1,7 +0,0 @@ -package NoOptions; -use Moose; - -with 'MooseX::Getopt'; - -package main; -NoOptions->new_with_options; diff --git a/t/version_with_options.pl b/t/version_with_options.pl deleted file mode 100644 index d3c7916..0000000 --- a/t/version_with_options.pl +++ /dev/null @@ -1,24 +0,0 @@ -package WithOptions; -use Moose; - -with 'MooseX::Getopt'; - -has print_version => ( - traits => [qw(Getopt)], - isa => 'Bool', - is => 'ro', - cmd_flag => 'version', - cmd_aliases => 'v', -); - -sub run { - my ($self) = @_; - - if ($self->print_version) { - print "SUCCESS\n"; - exit; - } -} - -package main; -WithOptions->new_with_options; diff --git a/t/version_with_simpleconfig.pl b/t/version_with_simpleconfig.pl deleted file mode 100644 index a6efd49..0000000 --- a/t/version_with_simpleconfig.pl +++ /dev/null @@ -1,33 +0,0 @@ -package WithOptionsAndSimpleConfig; -use Moose; - -with 'MooseX::Getopt'; - -has print_version => ( - traits => [qw(Getopt)], - isa => 'Bool', - is => 'ro', - cmd_flag => 'version', - cmd_aliases => 'v', -); - -has configfile => ( - traits => [qw(NoGetopt)], - isa => 'Str', - coerce => 1, - is => 'ro', -); - -with 'MooseX::SimpleConfig'; - -sub run { - my ($self) = @_; - - if ($self->print_version) { - print "SUCCESS\n"; - exit; - } -} - -package main; -WithOptionsAndSimpleConfig->new_with_options;