Agent-TCLI
view release on metacpan or search on metacpan
t/TCLI.Package.Tail.t view on Meta::CPAN
#!/usr/bin/env perl
# $Id: TCLI.Package.Tail.t 49 2007-04-25 10:32:36Z hacker $
use Test::More tests => 264;
use lib 'blib/lib';
use warnings;
use strict;
use Getopt::Long;
# process options
my ($verbose,$poe_td,$poe_te);
eval { GetOptions (
"verbose+" => \$verbose,
"event_trace+" => \$poe_te,
"default_trace+" => \$poe_td,
)};
if($@) {die "ERROR: $@";}
$verbose = 0 unless defined($verbose);
$poe_td = 0 unless defined($poe_td);
$poe_te = 0 unless defined($poe_te);
sub POE::Kernel::TRACE_DEFAULT () { $poe_td }
sub POE::Kernel::TRACE_EVENTS () { $poe_te }
sub POE::Component::SimpleLog::DEBUG () { 0 }
use Agent::TCLI::Transport::Test;
use Agent::TCLI::Testee;
use POE;
use Agent::TCLI::Package::Tail;
#use_ok('Agent::TCLI::Package::Tail');
my $test1 = Agent::TCLI::Package::Tail->new({
'verbose' => \$verbose,
'do_verbose' => sub { diag( @_ ) },
});
my $test_master = Agent::TCLI::Transport::Test->new({
'verbose' => \$verbose, # Verbose sets level or warnings
'do_verbose' => sub { diag( @_ ) },
'control_options' => {
'packages' => [ $test1, ],
},
});
my $t = Agent::TCLI::Testee->new(
'test_master' => $test_master,
'addressee' => 'self',
);
is($test1->name,'tcli_tail', '$test1->Name ');
my $test_c1 = $test1->commands();
is(ref($test_c1),'HASH', '$test1->Commands is a hash');
my $test_c1_0 = $test_c1->{'tail'};
is($test_c1_0->name,'tail', '$test_c1_0->name get from init args');
is($test_c1_0->usage,'tail file add file /var/log/messages', '$test_c1_0->usage get from init args');
is($test_c1_0->help,'tail a file', '$test_c1_0->help get from init args');
is($test_c1_0->topic,'testing', '$test_c1_0->topic get from init args');
is($test_c1_0->command,'tcli_tail', '$test_c1_0->command get from init args');
is($test_c1_0->handler,'establish_context', '$test_c1_0->handler get from init args');
is($test_c1_0->call_style,'session', '$test_c1_0->call_style get from init args');
my $function;
# In these tests I am mostly testing body, because I am testing the Command.
( run in 0.384 second using v1.01-cache-2.11-cpan-39bf76dae61 )