Agent-TCLI
view release on metacpan or search on metacpan
t/TCLI.Package.Base.t view on Meta::CPAN
#!/usr/bin/env perl
# $Id: TCLI.Package.Base.t 57 2007-04-30 11:07:22Z hacker $
use Test::More tests => 68;
use lib 'blib/lib';
use POE;
# TASK Test suite is not complete. Need testing for catching errors.
use_ok('Agent::TCLI::Package::Base');
use_ok('Agent::TCLI::Command');
use_ok('Agent::TCLI::Parameter');
my %cmd1 = (
'name' => 'cmd1',
'contexts' => {'/' => 'cmd1'},
'help' => 'cmd1 help',
'usage' => 'cmd1 usage',
'topic' => 'test',
'call_style'=> 'session',
'command' => 'test1',
'handler' => 'cmd1',
);
my %cmd2 = (
'name' => 'cmd2',
'contexts' => {'/' => 'cmd2'},
'help' => 'cmd2 help',
'usage' => 'cmd2 usage',
'topic' => 'test',
'call_style'=> 'session',
'command' => 'test1',
'handler' => 'cmd2',
);
my $cmd1 = Agent::TCLI::Command->new(%cmd1);
my $test1 = Agent::TCLI::Package::Base->new({
'name' => 'test1',
});
# Test Load Parameters
ok(!$test1->can('int1'),"parameter attribute not created yet");
$test1->LoadYaml(<<'...');
---
Agent::TCLI::Parameter:
name: int1
default: 1
help: integer one
constraints:
- INT
manual: This is the manual text.
type: Param
class: numeric
...
is($test1->parameters->{'int1'}->name,'int1',"single parameter loaded ok");
ok($test1->can('int1'),"parameter attribute created ok");
is($test1->meta->get_methods->{'int1'}{'type'},'numeric', "parameter :Type set ok");
is($test1->int1,1,"default set OK");
$test1->LoadYaml(<<'...');
---
Agent::TCLI::Parameter:
name: scalar1
default: some text
help: scalar one
( run in 0.708 second using v1.01-cache-2.11-cpan-39bf76dae61 )