Debian Codegraph @

t/08-unknown-command.t

raw
1 #!/usr/bin/perl -w
2 use strict;
3 use lib './inc';
4 use IO::Catch;
5 use File::Temp qw( tempfile );
6
7 # pre-5.8.0's warns aren't caught by a tied STDERR.
8 tie *STDOUT, 'IO::Catch', '_STDOUT_' or die $!;
9
10 use Test::More tests => 2;
11
12 # Disable all ReadLine functionality
13 $ENV{PERL_RL} = 0;
14
15 SKIP: {
16 #skip "Can't load Term::ReadKey without a terminal", 2
17 # unless -t STDIN;
18 #eval { require Term::ReadKey; Term::ReadKey::GetTerminalSize(); };
19 #if ($@) {
20 # no warnings 'redefine';
21 # *Term::ReadKey::GetTerminalSize = sub {80,24};
22 # diag "Term::ReadKey seems to want a terminal";
23 #};
24
25 use_ok('WWW::Mechanize::Shell');
26
27 # Silence all warnings
28 my $s = WWW::Mechanize::Shell->new( 'test', rcfile => undef, warnings => undef );
29
30 eval {
31 $s->cmd('this_command_does_not_exist');
32 };
33 is($@,"","An unknown command does not crash the shell");
34 };
35
36