Agent-TCLI

 view release on metacpan or  search on metacpan

t/TCLI.Command.GetoptLucid.t  view on Meta::CPAN


# Test usage get-set methods
is($test1->usage,'cmd1 usage', '$test1->usage get from init args');
ok($test2->usage('cmd2 usage'),'$test2->usage set ');
is($test2->usage,'cmd2 usage', '$test2->usage get from set');

# Test call_style get-set methods
is($test1->call_style,'session', '$test1->call_style get from init args');
ok($test2->call_style('state'),'$test2->call_style set ');
is($test2->call_style,'state', '$test2->call_style get from set');

# Test command get-set methods
is($test1->command,'test1', '$test1->command get from init args');
ok($test2->command('test2'),'$test2->command set ');
is($test2->command,'test2', '$test2->command get from set');

# Test handler get-set methods
is($test1->handler,'cmd1', '$test1->handler get from init args');
ok($test2->handler('cmd2'),'$test2->handler set ');
is($test2->handler,'cmd2', '$test2->handler get from set');

# Test GetoptLucid
my $testee = "GetoptLucid";

$request->args([qw(paramint 7 verbose)]);

my $opt1 = $test1->GetoptLucid($poe_kernel, $request );

is($opt1->get_paramint,7,"$testee paramint ok");
is($opt1->get_test_verbose,1,"$testee verbose ok");

$request->args([qw(paramA AAAAA verbose)]);

my $opt2 = $test2->GetoptLucid($poe_kernel, $request );

is($opt2->get_paramA,'AAAAA',"$testee paramA ok");
is($opt2->get_test_verbose,1,"$testee verbose ok");

# Test Validator
my $testee = "Validator";

$request->args([qw(paramint 7 verbose)]);

$opt1 = $test1->Validate($poe_kernel, $request);

is($opt1->{'paramint'},7,"$testee paramint ok");
is($opt1->{'test_verbose'},1,"$testee verbose ok");

$request->args([qw(paramA AAAAA verbose)]);

$opt2 = $test2->Validate($poe_kernel, $request);

is($opt2->{'paramA'},'AAAAA',"$testee paramA ok");
is($opt2->{'test_verbose'},1,"$testee verbose ok");

# Validate with no args
$request->args([ ]);

$opt1 = $test1->Validate($poe_kernel, $request);

is($opt1->{'paramint'},undef,"$testee paramint ok");
is($opt1->{'test_verbose'},undef,"$testee verbose ok");

$request->args([ ]);

$opt2 = $test2->Validate($poe_kernel, $request);

# Can't test for defaults without a package, so this is still undef
is($opt2->{'paramA'},undef,"$testee paramA ok");
is($opt2->{'test_verbose'},undef,"$testee verbose ok");



( run in 1.300 second using v1.01-cache-2.11-cpan-d80b1682f3f )