Permalink
Browse files

properly render the type of blessed objects in diagnostics

  • Loading branch information...
1 parent 24dcd33 commit 841d2f245e9f82be7eaf87b6dee15fe907d4d28e @karenetheridge karenetheridge committed Jul 10, 2012
Showing with 32 additions and 1 deletion.
  1. +4 −0 CHANGES
  2. +7 −0 lib/Test/Deep/Isa.pm
  3. +1 −1 t/isa.t
  4. +20 −0 t/rt78288_blessed_object.t
View
@@ -1,5 +1,9 @@
Revision history for Test-Deep
+ When printing diagnostics, differentiate the type of a blessed object
+ from the name of the class itself (RT#78288, caused by changes to how
+ blessed objects are treated in 0.109) (Karen Etheridge)
+
0.110 2012-06-16
Allow methods() and listmethods() to work again on class methods
View
@@ -33,4 +33,11 @@ sub diag_message
return "Checking class of $where with isa()";
}
+sub renderExp
+{
+ my $self = shift;
+
+ return "blessed into '$self->{val}'";
+}
+
1;
View
@@ -42,7 +42,7 @@ use t::std;
diag => <<EOM,
Checking class of \$data with isa()
got : $b
-expect : 'A'
+expect : blessed into 'A'
EOM
},
"isa eq"
View
@@ -0,0 +1,20 @@
+use strict;
+use warnings FATAL => 'all';
+
+use t::std;
+
+check_test(
+ sub { cmp_deeply('Foo', isa('Foo')) },
+ {
+ actual_ok => 0,
+ diag => <<EOM,
+Checking class of \$data with isa()
+ got : 'Foo'
+expect : blessed into 'Foo'
+EOM
+ },
+ 'isa on a string'
+);
+
+
+

0 comments on commit 841d2f2

Please sign in to comment.