# New Ticket Created by  "Kyle Hasselbacher" 
# Please include the string:  [perl #67860]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=67860 >


For example:

not ok 115 - xx= operator parses as item assignment 1# TODO LHS of @p
= @x xx= 3, 4
#      got: "a z a z a z 4"
# expected: "a z a z a z  4"

The strings used for 'got' and 'expected' come from .perl wrapped in a
try block, so it's safe and accurate.

Kyle.
>From b66fc54d1b7ce5f6ff7f44bd086fc61082170482 Mon Sep 17 00:00:00 2001
From: Kyle Hasselbacher <kyl...@gmail.com>
Date: Fri, 24 Jul 2009 12:29:17 -0500
Subject: [PATCH] [Test.pm] report expected and actual results after "is" test failure

---
 Test.pm |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Test.pm b/Test.pm
index 72517d0..ff60d0a 100644
--- a/Test.pm
+++ b/Test.pm
@@ -61,6 +61,14 @@ multi sub nok(Object $cond) is export(:DEFAULT) { nok($cond, ''); }
 multi sub is(Object $got, Object $expected, $desc) is export(:DEFAULT) {
     my $test = $got eq $expected;
     proclaim(?$test, $desc);
+    if !$test {
+        my $got_perl      = try { $got.perl };
+        my $expected_perl = try { $expected.perl };
+        if $got_perl.defined && $expected_perl.defined {
+            diag "     got: $got_perl";
+            diag "expected: $expected_perl";
+        }
+    }
 }
 
 multi sub is(Object $got, Object $expected) is export(:DEFAULT) { is($got, $expected, ''); }
-- 
1.6.3.3

Reply via email to