| 1 |
#!/usr/bin/perl -w |
| 2 |
use strict; |
| 3 |
use Test::More tests => 4; |
| 4 |
use File::Spec; |
| 5 |
use File::Temp qw(tempfile); |
| 6 |
|
| 7 |
my $perl = $^X; |
| 8 |
if ($perl =~ /\s/) { |
| 9 |
$perl = qq{"$perl"}; |
| 10 |
}; |
| 11 |
|
| 12 |
my ($fh,$temp) = tempfile(); |
| 13 |
print {$fh} "quit\n"; |
| 14 |
close $fh; |
| 15 |
|
| 16 |
my $res = system($perl, "-I./blib/lib", "-MWWW::Mechanize::Shell", "-eshell(warnings=>undef)", $temp); |
| 17 |
is $res,0,"Shell launch works"; |
| 18 |
is $?, 0, "No error on exit"; |
| 19 |
unlink $temp |
| 20 |
or diag "Couldn't remove '$temp': $!"; |
| 21 |
|
| 22 |
use_ok "WWW::Mechanize::Shell"; |
| 23 |
my $s = WWW::Mechanize::Shell->new("shell",warnings=>undef); |
| 24 |
my $prompt = eval { $s->prompt_str }; |
| 25 |
is $@, '', "prompt_str() doesn't die for empty WWW::Mechanize"; |