Change 20972 by [EMAIL PROTECTED] on 2003/08/31 15:12:10

        Add tests for -h and (unknown) -z.

Affected files ...

... //depot/perl/MANIFEST#1084 edit
... //depot/perl/t/run/switches.t#11 edit

Differences ...

==== //depot/perl/MANIFEST#1084 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#1083~20971~   Sun Aug 31 08:03:42 2003
+++ perl/MANIFEST       Sun Aug 31 08:12:10 2003
@@ -2843,7 +2843,7 @@
 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, -v)
+t/run/switches.t               Tests for the other switches (-0, -l, -c, -s, -M, -m, 
-V, -v, -h, -z)
 t/run/switchF.t                        Test the -F switch
 t/run/switchI.t                        Test the -I switch
 t/run/switchn.t                        Test the -n switch

==== //depot/perl/t/run/switches.t#11 (text) ====
Index: perl/t/run/switches.t
--- perl/t/run/switches.t#10~20971~     Sun Aug 31 08:03:42 2003
+++ perl/t/run/switches.t       Sun Aug 31 08:12:10 2003
@@ -1,6 +1,6 @@
 #!./perl -w
 
-# Tests for the command-line switches -0, -c, -l, -s, -m, -M, -V, -v
+# Tests for the command-line switches -0, -c, -l, -s, -m, -M, -V, -v, -h, -z
 # Some switches have their own tests, see MANIFEST.
 
 BEGIN {
@@ -10,7 +10,7 @@
 
 require "./test.pl";
 
-plan(tests => 22);
+plan(tests => 24);
 
 # 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 
@@ -216,12 +216,32 @@
 {
     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' );
+
+}
+
+# Tests for -h
+
+{
+    local $TODO = '';   # these ones should work on VMS
+
+    like( runperl( switches => ['-h'] ),
+         qr/Usage: .+perl.+switches.+programfile.+arguments/,
+          '-h looks okay' );
+
+}
+
+# Tests for -z (which does not exist)
+
+{
+    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' );
 
 }
End of Patch.

Reply via email to