Re: TODO and SKIP tests with Test::WWW::Mech

Andy Lester <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
On May 25, 2007, at 12:31 PM, Marvin Humphrey wrote:

> Is it possible to create Test::More-style SKIP and TODO tests with  
> Test::WWW::Mechanize?  Browsing the docs and searching the web  
> didn't turn up anything.
>
> I suppose it's possible to hack up an approximation using WWW::Mech  
> and Test::More using the "equivalent" code from Test::WWW::Mech's  
> synopsis, but maybe there's a better answer.

Test::WWW::Mechanize is built on Test::Builder, as is Test::More.   
Anything you can do in Test::More, you can do in Test::WWW::Mechanize.

SKIP: {
     skip "Not connected to Internet", 5 unless $connected_to_net;

     $mech->get_ok( "$lang.wikipedia.org" ) for qw( jp en kr de it );
}


TODO: {
     local $TODO = "Haven't worked out handling of text/snarfle  
encoding";

     $mech->get( "http://example.com/?encoding=snarfle" );
     is( $mech->content, 'Success!' );
}

Those are both perfectly valid.

xoxo,
Andy

--
Andy Lester => [email protected] => www.petdance.com => AIM:petdance
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.