Agent-TCLI

 view release on metacpan or  search on metacpan

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

#!/usr/bin/env perl
# $Id: TCLI.Command.GetoptLucid.t 57 2007-04-30 11:07:22Z hacker $

use Test::More tests => 36;
use Agent::TCLI::Parameter;
use Agent::TCLI::Request;
use Getopt::Lucid;
use POE;

use Data::Dump qw(pp);

# TASK Test suite is not complete. Need testing for catching errors.
BEGIN {
    use_ok('Agent::TCLI::Command');
}

my $request = Agent::TCLI::Request->new({
					'id'		=> 1,
					'args'		=> ['paramint', '7', 'verbose', ],
					'command'	=> ['testing', ],
					'sender'	=> 'Control',
					'postback'	=> 'TestResponse',
					'input'		=> 'testing paramint 7 verbose',
});


my $verbose = Agent::TCLI::Parameter->new(
    constraints => ['UINT'],
    help => "an integer for verbosity",
    manual => 'This debugging parameter can be used to adjust the verbose setting for the XMPP transport.',
    name => 'test_verbose',
    aliases => 'verbose|v',
    type => 'Counter',
);

my $paramint = Agent::TCLI::Parameter->new(
    constraints => ['UINT'],
    help => "an integer for a parameter",
    manual => 'This parameter is used to to test the Command package.',
    name => 'paramint',
    type => 'Param',
);

my $paramA = Agent::TCLI::Parameter->new(
    constraints	=> ['ASCII'],
    help 		=> "some text for a parameter",
    manual 		=> 'This parameter is used to to test the Command package.',
    name		=> 'paramA',
    type 		=> 'Param',
    default 	=> 'default',
);


my %cmd1 = (
	        'name'		=> 'cmd1',
	        'contexts'	=> {'/' => 'cmd1'},
    	    'help' 		=> 'cmd1 help',
        	'usage'		=> 'cmd1 usage',
        	'topic'		=> 'test',
        	'call_style'=> 'session',
        	'command'	=> 'test1',
	        'handler'	=> 'cmd1',
	        'parameters' => {
	        	'test_verbose' 	=> $verbose,
	        	'paramint'	=> $paramint,
	        	},
			'verbose' 	=> 0,
);
my %cmd2 = (
	        'name'		=> 'cmd2',
	        'contexts'	=> {'/' => 'cmd2'},
    	    'help' 		=> 'cmd2 help',



( run in 0.537 second using v1.01-cache-2.11-cpan-39bf76dae61 )