I've been trying out Test::Sweet<http://search.cpan.org/dist/Test-Sweet/lib/Test/Sweet.pm> and need a little help with the syntax. I'm not using MooseX::Declare so that may be part of my problem.
I was looking at bringing tests in from a role as shown with this the "from_role" test here: http://cpansearch.perl.org/src/JROCKWAY/Test-Sweet-0.03/t/Basic.pm Again, I'm not using the MooseX::Declare syntax in the Role: $ cat t/Role.pm package t::Role; use Moose::Role; use Test::Sweet; test in_role { pass 'Passed in_role' } no Moose::Role; 1; And the test is this -- where I'm NOT explicitly calling the in_role test: $ cat t/Test.pm package t::Test; use Moose; use Test::Sweet; with 't::Role'; test in_test { Passed 'in test' } __PACKAGE__->meta->make_immutable; 1; And when I run: $ perl -Mt::Test -le 't::Test->new->run' 1..2 # Test died: Can't locate object method "in_role" via package "t::Test" at /Users/bill/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1/Test/Sweet/Runnable.pm line 24. Can't locate object method "in_role" via package "t::Test" at /Users/bill/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1/Test/Sweet/Runnable.pm line 24. # Looks like your test exited with 255 before it could output anything. Can someone explain why that is failing and if it's related to MooseX::Declare? Also, $self is magically provided in the tests. How can I pass additional parameters to the tests (say calling one test from another)? For example, I'm testing in a Catalyst app and making mocked-up requests. I want to pass responses from one test onto another test. Thanks, -- Bill Moseley [email protected]
