Re: Why *not* use UNIVERSAL qw( isa can ) ; ??
[p5sagit/p5-mst-13.2.git] / t / op / repeat.t
index f935bf1..26f567d 100755 (executable)
@@ -2,7 +2,7 @@
 
 # $RCSfile: repeat.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:21 $
 
-print "1..20\n";
+print "1..23\n";
 
 # compile time
 
@@ -42,10 +42,15 @@ print join(':', (9,9) x 4) eq '9:9:9:9:9:9:9:9' ? "ok 18\n" : "not ok 18\n";
 print join('', (split(//,"123")) x 2) eq '123123' ? "ok 19\n" : "not ok 19\n";
 
 #
-# The test #20 is actually testing for Digital C compiler optimizer bug.
+# The test #20 is actually testing for Digital C compiler optimizer bug,
+# present in Dec C versions 5.* and 6.0 (used in Digital UNIX and VMS),
+# found in December 1998.  The bug was reported to Digital^WCompaq as
+#     DECC 2745 (21-Dec-1998)
+# GEM_BUGS 7619 (23-Dec-1998)
+# As of April 1999 the bug has been fixed in Tru64 UNIX 5.0 and is planned
+# to be fixed also in 4.0G.
 #
-# Dec C versions 5.* and 6.0 (used in Digital UNIX and VMS) used
-# to produce (as of December 1998) broken code for util.c:repeatcpy()
+# The bug was as follows: broken code was produced for util.c:repeatcpy()
 # (a utility function for the 'x' operator) in the case *all* these
 # four conditions held:
 #
@@ -68,9 +73,6 @@ print join('', (split(//,"123")) x 2) eq '123123' ? "ok 19\n" : "not ok 19\n";
 # 24 .........???????.???????
 # 25 .........???????.???????.
 #
-# The bug could be (obscurely) avoided by changing "from" to
-# be an unsigned char pointer.
-#
 # The bug was triggered in the "if (len == 1)" branch.  The fix
 # was to introduce a new temporary variable.  In diff -u format:
 #
@@ -85,9 +87,25 @@ print join('', (split(//,"123")) x 2) eq '123123' ? "ok 19\n" : "not ok 19\n";
 #        return;
 #     }
 #
+# The bug could also be (obscurely) avoided by changing "from" to
+# be an unsigned char pointer.
+#
 # This obscure bug was not found by the then test suite but instead
 # by Mark.Martinec@nsc.ijs.si while trying to install Digest-MD5-2.00.
 #
 # jhi@iki.fi
 #
 print "\xdd" x 24 eq "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" ? "ok 20\n" : "not ok 20\n";
+
+# When we use a list repeat in a scalar context, it behaves like
+# a scalar repeat. Make sure that works properly, and doesn't leave
+# extraneous values on the stack.
+#  -- robin@kitsite.com
+
+my ($x, $y) = scalar ((1,2)x2);
+print $x eq "22"  ? "ok 21\n" : "not ok 21\n";
+print !defined $y ? "ok 22\n" : "not ok 22\n";
+
+# Make sure the stack doesn't get truncated too much - the left
+# operand of the eq binop needs to remain!
+print (77 eq scalar ((1,7)x2) ? "ok 23\n" : "not ok 23\n");