1*0Sstevel@tonic-gate#!./perl -w 2*0Sstevel@tonic-gateuse strict; 3*0Sstevel@tonic-gate 4*0Sstevel@tonic-gateBEGIN { 5*0Sstevel@tonic-gate if ( $ENV{PERL_CORE} ) { 6*0Sstevel@tonic-gate chdir 't' if -d 't'; 7*0Sstevel@tonic-gate @INC = '../lib'; 8*0Sstevel@tonic-gate } 9*0Sstevel@tonic-gate} 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gatepackage Term::ReadLine::Mock; 12*0Sstevel@tonic-gateour @ISA = 'Term::ReadLine::Stub'; 13*0Sstevel@tonic-gatesub ReadLine {'Term::ReadLine::Mock'}; 14*0Sstevel@tonic-gatesub readline { "a line" } 15*0Sstevel@tonic-gatesub new { bless {} } 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gatepackage main; 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gateuse Test::More tests => 15; 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gateBEGIN { 22*0Sstevel@tonic-gate $ENV{PERL_RL} = 'Mock'; # test against our instrumented class 23*0Sstevel@tonic-gate use_ok('Term::ReadLine'); 24*0Sstevel@tonic-gate} 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gatemy $t = new Term::ReadLine 'test term::readline'; 27*0Sstevel@tonic-gate 28*0Sstevel@tonic-gateok($t, "made something"); 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gateisa_ok($t, 'Term::ReadLine::Mock'); 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gatefor my $method (qw( ReadLine readline addhistory IN OUT MinLine 33*0Sstevel@tonic-gate findConsole Attribs Features new ) ) { 34*0Sstevel@tonic-gate can_ok($t, $method); 35*0Sstevel@tonic-gate} 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gateis($t->ReadLine, 'Term::ReadLine::Mock', "\$object->ReadLine"); 38*0Sstevel@tonic-gateis($t->readline, 'a line', "\$object->readline"); 39*0Sstevel@tonic-gate 40