| 1 |
#!/usr/bin/perl -w |
| 2 |
use strict; |
| 3 |
|
| 4 |
use Test::More tests => 2; |
| 5 |
use WWW::Mechanize::Link; |
| 6 |
|
| 7 |
BEGIN { |
| 8 |
# Choose a nonannoying HTML displayer: |
| 9 |
$ENV{PERL_HTML_DISPLAY_CLASS} = 'HTML::Display::Dump'; |
| 10 |
# Disable all ReadLine functionality |
| 11 |
$ENV{PERL_RL} = 0; |
| 12 |
use_ok('WWW::Mechanize::Shell'); |
| 13 |
}; |
| 14 |
|
| 15 |
|
| 16 |
my $s = WWW::Mechanize::Shell->new( 'test', rcfile => undef, warnings => undef ); |
| 17 |
|
| 18 |
# Now test |
| 19 |
{ no warnings 'redefine'; |
| 20 |
local *WWW::Mechanize::find_all_links = sub { |
| 21 |
return (WWW::Mechanize::Link->new("","foo","",""),WWW::Mechanize::Link->new("","bar","","")) }; |
| 22 |
my @comps = $s->comp_open("fo","fo",0); |
| 23 |
is_deeply(\@comps,["foo"],"Completion works"); |
| 24 |
}; |
| 25 |
|
| 26 |
|