diff options
author | chromatic <chromatic@wgz.org> | 2001-10-08 08:05:32 -0600 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-10-08 21:20:45 +0000 |
commit | 6eca140854a73c1ec4270b4256675f7be02d7709 (patch) | |
tree | 9813626d8202b8190cc44a769c6daea8ffa94531 | |
parent | 7c36658b988154cf97fb44e48a4b69859fe075fb (diff) | |
download | perl-6eca140854a73c1ec4270b4256675f7be02d7709.tar.gz |
Fix Debian Failures on Test 22
Message-ID: <20011008201126.73702.qmail@onion.perl.org>
p4raw-id: //depot/perl@12368
-rw-r--r-- | lib/Term/Cap.t | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/Term/Cap.t b/lib/Term/Cap.t index f3da8c93e9..86198dc791 100644 --- a/lib/Term/Cap.t +++ b/lib/Term/Cap.t @@ -1,6 +1,8 @@ #!./perl +my $file; BEGIN { + $file = $0; chdir 't' if -d 't'; @INC = '../lib'; } @@ -34,14 +36,14 @@ is( $path, $files, 'termcap_path() should find default files' ); SKIP: { # this is ugly, but -f $0 really *ought* to work - skip("-f $0 fails, some tests difficult now", 2) unless -f $0; + skip("-f $file fails, some tests difficult now", 2) unless -f $file; - $ENV{TERMCAP} = $ENV{TERMPATH} = $0; - ok( grep($0, Term::Cap::termcap_path()), + $ENV{TERMCAP} = $ENV{TERMPATH} = $file; + ok( grep($file, Term::Cap::termcap_path()), 'termcap_path() should find file from $ENV{TERMCAP}' ); $ENV{TERMCAP} = (grep { $^O eq $_ } qw( os2 MSWin32 dos )) ? 'a:/' : '/'; - ok( grep($0, Term::Cap::termcap_path()), + ok( grep($file, Term::Cap::termcap_path()), 'termcap_path() should find file from $ENV{TERMPATH}' ); } @@ -100,18 +102,17 @@ $ENV{TERMCAP} = ''; eval { $t = Term::Cap->Tgetent($vals) }; isn't( $@, '', 'Tgetent() should catch bad termcap file' ); -# if there's no valid termcap file found, it should croak -$vals->{TERM} = ''; -$ENV{TERMPATH} = $0; -eval { $t = Term::Cap->Tgetent($vals) }; -like( $@, qr/failed termcap lookup/, 'Tgetent() should dies with bad termcap' ); - SKIP: { - skip( "Can't write 'tcout' file for tests", 8 ) unless $writable; + skip( "Can't write 'tcout' file for tests", 9 ) unless $writable; + + # it won't find the termtype in this fake file, so it should croak + $vals->{TERM} = 'quux'; + $ENV{TERMPATH} = 'tcout'; + eval { $t = Term::Cap->Tgetent($vals) }; + like( $@, qr/failed termcap/, 'Tgetent() should die with bad termcap' ); # it shouldn't try to read one file more than 32(!) times # see __END__ for a really awful termcap example - $ENV{TERMPATH} = join(' ', ('tcout') x 33); $vals->{TERM} = 'bar'; eval { $t = Term::Cap->Tgetent($vals) }; |