Skip Menu |

This queue is for tickets about the Test-Simpler CPAN distribution.

Report information
The Basics
Id: 83801
Status: open
Priority: 0/
Queue: Test-Simpler

People
Owner: Nobody in particular
Requestors: marks.anthony [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Reporting errors when retrieving object attributes...
Date: Thu, 7 Mar 2013 16:21:40 +1100
To: bug-test-simpler [...] rt.cpan.org
From: Anthony Marks <marks.anthony [...] gmail.com>
Dear Damian, Thank you for Test::Simpler. I was wondering why, when failing to get an object attribute, the failure description is returning an 'undef'. I have the following example code: package Quote; use Moose; use Modern::Perl; has 'security_desc' => (is => 'ro', required => 1); has 'asx_code' => (is => 'ro', required => 1); # DEBUG say "Testing $qbe->security_desc . " (" . $qbe->asx_code . ")"; use Test::Simpler tests => 3; our $TODO; # Instantiate a Quote for QBE... my %QBE_RAW_DATA = ( 'security_desc' => 'QBE Insurance Grp', 'asx_code' => 'QBE', ); my $qbe = Quote->new(%QBE_RAW_DATA); # Test object and attributes.... ok( defined($qbe) && ref $qbe eq 'Quote', 'Quote->new() works' ); ok( $qbe->security_desc eq 'QBE Insurance Grp', 'get security_desc' ); TODO:{ local $TODO = q{Purposely fail retrieving asx_code ('QBE' != 'EQB') to see how Test::Simpler reports it.}; ok( $qbe->asx_code eq 'EBQ','get asx_code' ); } which produces the following output with "prove -v": object-testing.t .. 1..3 ok 1 - Quote->new() works ok 2 - get security_desc not ok 3 - get asx_code # TODO Purposely fail retrieving asx_code ('QBE' != 'EQB') # to see how Test::Simpler reports it. # Failed test at object-testing.t line 30 # $qbe->asx_code # isn't eq # 'EBQ' # Because: # $qbe-> --> undef # # 'EBQ' --> EBQ ok All tests successful. Files=1, Tests=3, 2 wallclock secs ( 0.10 usr + 0.03 sys = 0.13 CPU) Result: PASS I was just wondering why the "Because;" does not actually retrieve the attribute value ('QBE') to highlight the mismatch? Many thanks, Anthony Marks

Message body is not shown because sender requested not to inline it.

Download object-testing.out
application/octet-stream 506b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #83801] Reporting errors when retrieving object attributes...
Date: Thu, 7 Mar 2013 17:17:22 +0000
To: bug-Test-Simpler [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Hi Anthony, That is definitely a bug. The problem was in the code that parses symbols...I had forgotten that method calls are also possible after a -> (I was only checking for indexing operations). I've just uploaded a new version (0.000006) of the module to CPAN with what I hope is a comprehensive solution. If you'd care to download it once it propagates and see if it fixes your issue, I'd be grateful. All the best, Damian
Subject: Re: [rt.cpan.org #83801] Reporting errors when retrieving object attributes...
Date: Fri, 8 Mar 2013 10:34:33 +1100
To: bug-Test-Simpler [...] rt.cpan.org
From: Anthony Marks <marks.anthony [...] gmail.com>
Hi Damian, Thank you very much for the quick reply and fix. "QBE" is now QED. Much appreciated. Anthony. On 8 March 2013 04:18, damian@conway.org via RT < bug-Test-Simpler@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=83801 > > > Hi Anthony, > > That is definitely a bug. > > The problem was in the code that parses symbols...I had forgotten that > method calls are also possible after a -> (I was only checking for indexing > operations). > > I've just uploaded a new version (0.000006) of the module to CPAN with > what I hope is a comprehensive solution. If you'd care to download it > once it propagates and see if it fixes your issue, I'd be grateful. > > All the best, > > Damian > >