[svn:parrot] r35796 - trunk/languages/perl6

[email protected] Tue, 20 Jan 2009 03:45:29 -0800 (PST)
Newsgroups perl.cvs.parrot
Message-ID <[email protected]>
Author: jonathan
Date: Tue Jan 20 03:45:28 2009
New Revision: 35796

Modified:
   trunk/languages/perl6/Test.pm

Log:
[rakudo] Seems Test.pm was patched with extra features, but unfortunately that causes it to break on a few tests. This patch tweaks the workaround for some things not having a .perl method, which gets us passing pretty much everything again, aside from fail.t, which I'm really not sure what is wrong with yet...

Modified: trunk/languages/perl6/Test.pm
==============================================================================
--- trunk/languages/perl6/Test.pm	(original)
+++ trunk/languages/perl6/Test.pm	Tue Jan 20 03:45:28 2009
@@ -179,11 +179,10 @@
 ## 'private' subs
 
 sub diag_bool_true($passed) {
-    # Workaround for: Method 'perl' not found for invocant of class 'Match'
-    # and issues with the Exception&Iterator class might work, but I don't grok it.
-    my $have = $passed.WHAT eq any(<Match Exception Iterator>)
-        ?? $passed
-        !! $passed.perl;
+    # Workaround for: Method 'perl' not found for invocant (various classes,
+    # including some anonymous, so can't just make a list).
+    my $have;
+    try { $have = $passed.perl; CATCH { $have = $passed } }
     return $passed
         ?? ''
         !! "# Expected a true value.\n# have: {$have}";
@@ -196,11 +195,10 @@
 }
 
 sub diag_eq($passed, $have, $want) {
-    # Workaround for: Method 'perl' not found for invocant of class 'Match'
-    # and issues with the Exception&Iterator class might work, but I don't grok it.
-    my $x_have = $passed.WHAT eq any(<Match Exception Iterator>)
-        ?? $passed
-        !! $passed.perl;
+    # Workaround for: Method 'perl' not found for invocant (various classes,
+    # including some anonymous, so can't just make a list).
+    my $x_have;
+    try { $x_have = $passed.perl; CATCH { $x_have = $passed } }
     return $passed ?? '' !! "# have: {$x_have}\n# want: {$want.perl}";
 }