From: Jarkko Hietaniemi Date: Sun, 31 Aug 2003 15:03:42 +0000 (+0000) Subject: Add test for -v. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ceda46a1c0a98bad243238d3009e5242fa9ed075;p=p5sagit%2Fp5-mst-13.2.git Add test for -v. p4raw-id: //depot/perl@20971 --- diff --git a/MANIFEST b/MANIFEST index 226732b..a308683 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2843,7 +2843,7 @@ t/run/switcha.t Test the -a switch t/run/switch_A.t Test the -A switch t/run/switchC.t Test the -C switch t/run/switchd.t Test the -d switch -t/run/switches.t Tests for the other switches (-0, -l, -c, -s, -M, -m, -V) +t/run/switches.t Tests for the other switches (-0, -l, -c, -s, -M, -m, -V, -v) t/run/switchF.t Test the -F switch t/run/switchI.t Test the -I switch t/run/switchn.t Test the -n switch diff --git a/t/run/switches.t b/t/run/switches.t index 8d9cd89..35317ca 100644 --- a/t/run/switches.t +++ b/t/run/switches.t @@ -1,6 +1,6 @@ #!./perl -w -# Tests for the command-line switches -0, -c, -l, -s, -m, -M, -V +# Tests for the command-line switches -0, -c, -l, -s, -m, -M, -V, -v # Some switches have their own tests, see MANIFEST. BEGIN { @@ -10,7 +10,7 @@ BEGIN { require "./test.pl"; -plan(tests => 20); +plan(tests => 22); # due to a bug in VMS's piping which makes it impossible for runperl() # to emulate echo -n (ie. stdin always winds up with a newline), these @@ -183,10 +183,14 @@ SWTESTPM local $TODO = ''; # these ones should work on VMS # basic perl -V should generate significant output. - # we don't test actual format since it could change + # we don't test actual format too much since it could change like( runperl( switches => ['-V'] ), qr/(\n.*){20}/, '-V generates 20+ lines' ); + like( runperl( switches => ['-V'] ), + qr/\ASummary of my perl5 .*configuration:/, + '-V looks okay' ); + # lookup a known config var chomp( $r=runperl( switches => ['-V:osname'] ) ); is( $r, "osname='$^O';", 'perl -V:osname'); @@ -206,3 +210,18 @@ SWTESTPM # make sure each line we got matches the re ok( !( grep !/^i\D+size=/, split /^/, $r ), '-V:re correct' ); } + +# Tests for -v + +{ + local $TODO = ''; # these ones should work on VMS + + # basic perl -V should generate significant output. + # we don't test actual format since it could change + my $v = sprintf "%vd", $^V; + use Config; + like( runperl( switches => ['-v'] ), + qr/This is perl, v$v built for $Config{archname}.+Copyright.+Larry Wall.+Artistic License.+GNU General Public License/s, + '-v looks okay' ); + +}