From: Nicholas Clark Date: Sat, 25 Aug 2007 22:04:06 +0000 (+0000) Subject: Test that all the unknown command line flags are unknown. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fed0ca7f5100fe80067cf8ec5732417aa7f8f903;p=p5sagit%2Fp5-mst-13.2.git Test that all the unknown command line flags are unknown. p4raw-id: //depot/perl@31754 --- diff --git a/t/run/switches.t b/t/run/switches.t index 7a778a4..7312e1e 100644 --- a/t/run/switches.t +++ b/t/run/switches.t @@ -1,7 +1,7 @@ #!./perl -w # Tests for the command-line switches: -# -0, -c, -l, -s, -m, -M, -V, -v, -h, -z, -i, -E +# -0, -c, -l, -s, -m, -M, -V, -v, -h, -i, -E and all unknown # Some switches have their own tests, see MANIFEST. BEGIN { @@ -11,7 +11,7 @@ BEGIN { BEGIN { require "./test.pl"; } -plan(tests => 31); +plan(tests => 62); use Config; @@ -253,14 +253,16 @@ SWTESTPM } -# Tests for -z (which does not exist) +# Tests for switches which do not exist +foreach my $switch (split //, "ABbGgHJjKkLNOoQqRrYyZz123456789_") { local $TODO = ''; # these ones should work on VMS - like( runperl( switches => ['-z'], stderr => 1 ), - qr/\QUnrecognized switch: -z (-h will show valid options)./, - '-z correctly unknown' ); + like( runperl( switches => ["-$switch"], stderr => 1, + prog => 'die "oops"' ), + qr/\QUnrecognized switch: -$switch (-h will show valid options)./, + "-$switch correctly unknown" ); }