Skip Menu |

This queue is for tickets about the Catalyst CPAN distribution.

Report information
The Basics
Id: 16979
Status: resolved
Priority: 0/
Queue: Catalyst

People
Owner: Nobody in particular
Requestors: david [...] kineticode.com
Cc:
AdminCc:

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



To: bug-catalyst [...] rt.cpan.org
From: David Wheeler <david [...] kineticode.com>
Subject: Generated Tests Need Help
Date: Mon, 9 Jan 2006 12:32:56 -0800
I'm using Catalystd 5.61. Here's what a test file looks like after I run `catalyst.pl MiniMojo`: use Test::More tests => 2; BEGIN { use_ok( Catalyst::Test, 'MiniMojo' ); } ok( request('/')->is_success ); I always like to have warnings and strict on, so I changed it to this: #!/usr/bin/perl -w use strict; use Test::More tests => 2; BEGIN { use_ok( Catalyst::Test, 'MiniMojo' ); } ok( request('/')->is_success ); This causes the test to fail rather mysteriously: Execution of t/01app.t aborted due to compilation errors. But it doesn't say why. It took me half an hour to figure it that it was because Catalyst::Test is a bare word, which is not allowed under strict. Why there isn't a message about that I have no idea, but please, *please*, add -w and strict to the generated tests and quote Catalyst::Test. Now, another issue: When I run the above test, it outputs a ton of junk from the Catalyst HTTP server (I assume). This is all well and good, but none of it is properly escaped for Test::Harness. All lines should start with "#", or else you risk confusing Test::Harness as it tries to keep track of tests. But even better, make sure that it's outputting the right thing! Here's how I'd like to see the default test written, instead: #!/usr/bin/perl -w use strict; use Test::More tests => 4; use Test::Output; BEGIN { stderr_like { use_ok 'Catalyst::Test', 'MiniMojo' } qr/MiniMojo/, 'MiniMojo should be in the Catalyst output'; } stderr_like { ok request('/')->is_success, 'Basic request should succeed' } qr{/default}, '... And the output should reflect that'; Yes, it introduces a dependency on Test::Output, but all of the noisy output has got to go. Best, David
From: David Wheeler <david [...] kineticode.com>
Subject: Re: [cpan #16979] AutoReply: Generated Tests Need Help
Date: Mon, 9 Jan 2006 12:35:52 -0800
To: bug-Catalyst [...] rt.cpan.org
RT-Send-Cc:
On Jan 9, 2006, at 12:33 PM, Catalyst wrote: Show quoted text
> Here's how I'd like to see the default test written, instead:
Nicer line wrapping: #!/usr/bin/perl -w use strict; use Test::More tests => 4; use Test::Output; BEGIN { stderr_like { use_ok 'Catalyst::Test', 'MiniMojo'; } qr/MiniMojo/, 'MiniMojo should be in the Catalyst output'; } stderr_like { ok request('/')->is_success, 'Basic request should succeed'; } qr{/default}, '... And the output should reflect that';
From: David Wheeler <david [...] kineticode.com>
Subject: Re: [cpan #16979] AutoReply: Generated Tests Need Help
Date: Mon, 9 Jan 2006 12:45:35 -0800
To: bug-Catalyst [...] rt.cpan.org
RT-Send-Cc:
Cross-posted to http://dev.catalyst.perl.org/ticket/57 Apologies for the duplication.