summaryrefslogtreecommitdiff
path: root/t/run
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-01-31 22:48:13 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-31 22:48:13 +0000
commite54d2dfa4791be271f65522bd8896292a87cdd6f (patch)
tree73911e0e49852407cf46e13b5080c84e0bbb1c60 /t/run
parent7ca610e8950d7a80c2a867e30815a14eaf8a9a56 (diff)
downloadperl-e54d2dfa4791be271f65522bd8896292a87cdd6f.tar.gz
Re: [PATCH] perl -V:
From: sthoenna@efn.org (Yitzchak Scott-Thoennes) Date: Thu, 31 Jan 2002 12:10:20 -0800 Message-ID: <sSaW8gzkgaNQ092yn@efn.org> Subject: Re: [PATCH] perl -V: From: Michael G Schwern <schwern@pobox.com> Date: Thu, 31 Jan 2002 16:43:13 -0500 Message-ID: <20020131214313.GH6498@blackrider> p4raw-id: //depot/perl@14510
Diffstat (limited to 't/run')
-rw-r--r--t/run/switches.t35
1 files changed, 33 insertions, 2 deletions
diff --git a/t/run/switches.t b/t/run/switches.t
index f920f37ca7..996ad5d4c6 100644
--- a/t/run/switches.t
+++ b/t/run/switches.t
@@ -9,10 +9,11 @@ BEGIN {
require "./test.pl";
-plan(tests => 14);
+plan(tests => 19);
# due to a bug in VMS's piping which makes it impossible for runperl()
-# to emulate echo -n, these tests almost totally fail.
+# to emulate echo -n (ie. stdin always winds up with a newline), these
+# tests almost totally fail.
$TODO = "runperl() unable to emulate echo -n due to pipe bug" if $^O eq 'VMS';
my $r;
@@ -169,3 +170,33 @@ SWTESTPM
is( $r, '<swtest><foo><bar>', '-m with import parameters' );
push @tmpfiles, $filename;
}
+
+# 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
+ like( runperl( switches => ['-V'] ), qr/(\n.*){20}/,
+ '-V generates 20+ lines' );
+
+ # lookup a known config var
+ chomp( $r=runperl( switches => ['-V:osname'] ) );
+ is( $r, "osname='$^O';", 'perl -V:osname');
+
+ # lookup a nonexistent var
+ chomp( $r=runperl( switches => ['-V:this_var_makes_switches_test_fail'] ) );
+ is( $r, "this_var_makes_switches_test_fail='UNKNOWN';",
+ 'perl -V:unknown var');
+
+ # regexp lookup
+ # platforms that don't like this quoting can either skip this test
+ # or fix test.pl _quote_args
+ $r = runperl( switches => ['"-V:i\D+size"'] );
+ # should be unlike( $r, qr/^$|not found|UNKNOWN/ );
+ like( $r, qr/^(?!.*(not found|UNKNOWN))./, 'perl -V:re got a result' );
+
+ # make sure each line we got matches the re
+ ok( !( grep !/^i\D+size=/, split /^/, $r ), '-V:re correct' );
+}