Line | |
---|
1 | #!./perl -w
|
---|
2 | use strict;
|
---|
3 |
|
---|
4 | BEGIN {
|
---|
5 | if ( $ENV{PERL_CORE} ) {
|
---|
6 | chdir 't' if -d 't';
|
---|
7 | @INC = '../lib';
|
---|
8 | }
|
---|
9 | }
|
---|
10 |
|
---|
11 | package Term::ReadLine::Mock;
|
---|
12 | our @ISA = 'Term::ReadLine::Stub';
|
---|
13 | sub ReadLine {'Term::ReadLine::Mock'};
|
---|
14 | sub readline { "a line" }
|
---|
15 | sub new { bless {} }
|
---|
16 |
|
---|
17 | package main;
|
---|
18 |
|
---|
19 | use Test::More tests => 15;
|
---|
20 |
|
---|
21 | BEGIN {
|
---|
22 | $ENV{PERL_RL} = 'Mock'; # test against our instrumented class
|
---|
23 | use_ok('Term::ReadLine');
|
---|
24 | }
|
---|
25 |
|
---|
26 | my $t = new Term::ReadLine 'test term::readline';
|
---|
27 |
|
---|
28 | ok($t, "made something");
|
---|
29 |
|
---|
30 | isa_ok($t, 'Term::ReadLine::Mock');
|
---|
31 |
|
---|
32 | for my $method (qw( ReadLine readline addhistory IN OUT MinLine
|
---|
33 | findConsole Attribs Features new ) ) {
|
---|
34 | can_ok($t, $method);
|
---|
35 | }
|
---|
36 |
|
---|
37 | is($t->ReadLine, 'Term::ReadLine::Mock', "\$object->ReadLine");
|
---|
38 | is($t->readline, 'a line', "\$object->readline");
|
---|
39 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.