new tests for swiches -n -p -a -F
Rafael Garcia-Suarez [Sat, 10 Nov 2001 00:10:45 +0000 (01:10 +0100)]
Message-ID: <20011110001045.A11945@rafael>

p4raw-id: //depot/perl@12923

MANIFEST
t/run/noswitch.t [new file with mode: 0644]
t/run/switchF.t [new file with mode: 0644]
t/run/switcha.t [new file with mode: 0644]
t/run/switchn.t [new file with mode: 0644]
t/run/switchp.t [new file with mode: 0644]

index 63b0257..be70662 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -2263,6 +2263,11 @@ t/README                 Instructions for regression tests
 t/run/exit.t                    Test perl's exit status.
 t/run/kill_perl.t               Tests that kill perl.
 t/run/runenv.t                 Test if perl honors its environment variables.
+t/run/noswitch.t               Test aliasing ARGV for other switch tests
+t/run/switchp.t                        Test the -p switch
+t/run/switchn.t                        Test the -n switch
+t/run/switcha.t                        Test the -a switch
+t/run/switchF.t                        Test the -F switch
 t/TEST                         The regression tester
 t/test.pl                      Simple testing library
 t/TestInit.pm                  Preamble library for core tests
diff --git a/t/run/noswitch.t b/t/run/noswitch.t
new file mode 100644 (file)
index 0000000..a902c1f
--- /dev/null
@@ -0,0 +1,12 @@
+#!./perl
+
+BEGIN {
+    print "1..3\n";
+    *ARGV = *DATA;
+}
+print "ok 1\n";
+print <>;
+print "ok 3\n";
+
+__DATA__
+ok 2 - read from aliased DATA filehandle
diff --git a/t/run/switchF.t b/t/run/switchF.t
new file mode 100644 (file)
index 0000000..a6e9031
--- /dev/null
@@ -0,0 +1,11 @@
+#!./perl -anFx+
+
+BEGIN {
+    print "1..2\n";
+    *ARGV = *DATA;
+}
+print "@F";
+
+__DATA__
+okx1
+okxxx2
diff --git a/t/run/switcha.t b/t/run/switcha.t
new file mode 100644 (file)
index 0000000..ec2f0cc
--- /dev/null
@@ -0,0 +1,12 @@
+#!./perl -na
+
+BEGIN {
+    print "1..2\n";
+    *ARGV = *DATA;
+    $i = 0;
+}
+print "$F[1] ",++$i,"\n";
+
+__DATA__
+not ok
+not ok 3
diff --git a/t/run/switchn.t b/t/run/switchn.t
new file mode 100644 (file)
index 0000000..12d3898
--- /dev/null
@@ -0,0 +1,11 @@
+#!./perl -n
+
+BEGIN {
+    print "1..2\n";
+    *ARGV = *DATA;
+}
+print;
+
+__DATA__
+ok 1
+ok 2
diff --git a/t/run/switchp.t b/t/run/switchp.t
new file mode 100644 (file)
index 0000000..1994735
--- /dev/null
@@ -0,0 +1,10 @@
+#!./perl -p
+
+BEGIN {
+    print "1..2\n";
+    *ARGV = *DATA;
+}
+
+__DATA__
+ok 1
+ok 2