| 1 | #!/usr/bin/perl -w |
| 2 | use strictscip-perl cpan WWW-Mechanize-Shell 0.62 strict/; |
| 3 | use libscip-perl cpan WWW-Mechanize-Shell 0.62 lib/ './inc'; |
| 4 | use IO::Catchscip-perl cpan WWW-Mechanize-Shell 0.62 IO/Catch/; |
| 5 | |
| 6 | our ($_STDOUT_scip-perl cpan WWW-Mechanize-Shell 0.62 main/$_STDOUT_., $_STDERR_scip-perl cpan WWW-Mechanize-Shell 0.62 main/$_STDERR_.); |
| 7 | tie *STDOUT, 'IO::Catch', '_STDOUT_' or diescip-perl cpan WWW-Mechanize-Shell 0.62 main/die(). $!scip-perl cpan WWW-Mechanize-Shell 0.62 main/`$!`.; |
| 8 | tie *STDERR, 'IO::Catch', '_STDERR_' or diescip-perl cpan WWW-Mechanize-Shell 0.62 main/die(). $!scip-perl cpan WWW-Mechanize-Shell 0.62 main/`$!`.; |
| 9 | |
| 10 | use Test::Morescip-perl cpan WWW-Mechanize-Shell 0.62 Test/More/ tests => 4; |
| 11 | |
| 12 | # Disable all ReadLine functionality |
| 13 | $ENVscip-perl cpan WWW-Mechanize-Shell 0.62 main/`%ENV`.{PERL_RL} = 0; |
| 14 | deletescip-perl cpan WWW-Mechanize-Shell 0.62 main/delete(). $ENVscip-perl cpan WWW-Mechanize-Shell 0.62 main/`%ENV`.{PAGER} |
| 15 | if $ENVscip-perl cpan WWW-Mechanize-Shell 0.62 main/`%ENV`.{PAGER}; |
| 16 | $ENVscip-perl cpan WWW-Mechanize-Shell 0.62 main/`%ENV`.{PERL_HTML_DISPLAY_CLASS}="HTML::Display::Dump"; |
| 17 | |
| 18 | my @warnings; |
| 19 | |
| 20 | use_okscip-perl cpan WWW-Mechanize-Shell 0.62 main/use_ok().('WWW::Mechanize::Shell'); |
| 21 | my $s = WWW::Mechanize::Shell->newscip-perl cpan WWW-Mechanize-Shell 0.62 WWW/Mechanize/Shell/new().( 'test', rcfile => undef, warnings => undef ); |
| 22 | |
| 23 | { no warnings qw'redefine once'; |
| 24 | *WWW::Mechanize::Shell::status = sub {}; |
| 25 | }; |
| 26 | |
| 27 | $s->agentscip-perl cpan WWW-Mechanize-Shell 0.62 WWW/Mechanize/Shell/agent().->{base} = 'http://www.google.com/'; |
| 28 | $s->agentscip-perl cpan WWW-Mechanize-Shell 0.62 WWW/Mechanize/Shell/agent().->update_htmlscip-perl cpan WWW-Mechanize-Shell 0.62 main/update_html().("<html><body>No form here</body></html>\n"); |
| 29 | |
| 30 | eval { |
| 31 | $s->cmdscip-perl cpan WWW-Mechanize-Shell 0.62 WWW/Mechanize/Shell/cmd().("form foo"); |
| 32 | }; |
| 33 | isscip-perl cpan WWW-Mechanize-Shell 0.62 main/is().($@scip-perl cpan WWW-Mechanize-Shell 0.62 main/`$@`., '', "Can execute 'form' for a page without forms"); |
| 34 | isscip-perl cpan WWW-Mechanize-Shell 0.62 main/is().($_STDOUT_scip-perl cpan WWW-Mechanize-Shell 0.62 main/$_STDOUT_.,"There is no form on this page.\n","Message was printed"); |
| 35 | isscip-perl cpan WWW-Mechanize-Shell 0.62 main/is().($_STDERR_scip-perl cpan WWW-Mechanize-Shell 0.62 main/$_STDERR_.,undef,"No warnings printed"); |
| 36 | |
| 37 | #$_STDOUT_ = undef; |
| 38 | #$_STDERR_ = undef; |
| 39 | |
| 40 | #$s->cmd("save /does-not-exist/"); |
| 41 | #is($_STDOUT_,"No match for /(?-xism:does-not-exist)/.\n","save RE error message"); |
| 42 | #is($_STDERR_,undef,"No warnings"); |
| 43 | |
| 44 |