Debian Codegraph @

t/00a-Term-Shell-catch-smry.t

raw
1 use strict;
2 use Test::More tests => 1;
3 use lib 'inc';
4 use IO::Catch;
5
6 # Disable all ReadLine functionality
7 $ENV{PERL_RL} = 0;
8 $ENV{COLUMNS} = 80;
9 $ENV{LINES} = 24;
10
11 TODO: {
12 #local $TODO = "Term::Shell::catch_smry is buggy";
13
14 # Now check that the Term::Shell summary calls catch_smry
15
16 require Term::Shell;
17 our $called;
18 {
19 package Term::Shell::Test;
20 use base 'Term::Shell';
21 sub summary { $::called++ };
22 sub print_pairs {};
23 };
24 my $s = { handlers => { foo => { run => sub {}}} };
25 bless $s, 'Term::Shell::Test';
26
27 { local *STDOUT;
28 tie *STDOUT, 'IO::Catch', '_STDOUT_';
29 $s->run_help();
30 };
31
32 if (not is($called,1,"Term::Shell::Test::catch_smry gets called for unknown methods")) {
33 diag "Term::Shell did not call a custom catch_smry handler";
34 diag "This is most likely because your version of Term::Shell";
35 diag "has a bug. Please upgrade to v0.02 or higher, which";
36 diag "should close this bug.";
37 diag "If that is no option, patch sub help() in Term/Shell.pm, line 641ff.";
38 diag "to:";
39 diag ' #my $smry = exists $o->{handlers}{$h}{smry};';
40 diag ' #? $o->summary($h);';
41 diag ' #: "undocumented";';
42 diag ' my $smry = $o->summary($h);';
43 diag 'Fixing this is not necessary - you will get no online help';
44 diag 'but the shell will otherwise work fine. Help is still';
45 diag 'available through ``perldoc WWW::Mechanize::Shell``';
46 };
47 };
48