This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Comply with the 0x80th commandment
[perl5.git] / lib / Term / ReadLine.t
CommitLineData
e15d0a48
RC
1#!./perl -w
2use strict;
3
4BEGIN {
5 if ( $ENV{PERL_CORE} ) {
6 chdir 't' if -d 't';
7 @INC = '../lib';
8 }
9}
10
11package Term::ReadLine::Mock;
12our @ISA = 'Term::ReadLine::Stub';
13sub ReadLine {'Term::ReadLine::Mock'};
14sub readline { "a line" }
15sub new { bless {} }
16
17package main;
18
19use Test::More tests => 15;
20
21BEGIN {
22 $ENV{PERL_RL} = 'Mock'; # test against our instrumented class
23 use_ok('Term::ReadLine');
24}
25
26my $t = new Term::ReadLine 'test term::readline';
27
28ok($t, "made something");
29
30isa_ok($t, 'Term::ReadLine::Mock');
31
32for my $method (qw( ReadLine readline addhistory IN OUT MinLine
33 findConsole Attribs Features new ) ) {
34 can_ok($t, $method);
35}
36
37is($t->ReadLine, 'Term::ReadLine::Mock', "\$object->ReadLine");
38is($t->readline, 'a line', "\$object->readline");
39