Agent-TCLI
view release on metacpan or search on metacpan
t/TCLI.Parameter.t view on Meta::CPAN
#!/usr/bin/env perl
# $Id: TCLI.Parameter.t 48 2007-04-11 12:43:07Z hacker $
use Test::More qw(no_plan);
use lib 'blib/lib';
use warnings;
use strict;
# TASK Test suite is not complete. Need more testing for catching errors.
BEGIN {
use_ok('Agent::TCLI::Parameter');
}
my $test1 = Agent::TCLI::Parameter->new(
name => 'test1',
aliases => 't1',
constraints => ['ASCII'],
help => "text for a parameter",
manual =>
'This parameter is used for testing the module.',
type => 'Param',
default => 'text',
class => 'Test::Test',
show_method => 'print',
cl_option => '-t'
);
my $test2 = Agent::TCLI::Parameter->new(
# name => 'test2',
# aliases => 'i1',
# constraints => ['INT'],
# help => "int for a parameter",
# manual =>
# 'This parameter is used for testing the module.',
# type => 'Param',
# default => 42,
# class => 'Test::Test',
# show_method => 'print',
# cl_option => '-i'
);
is(ref($test1),'Agent::TCLI::Parameter','new test1 object');
is(ref($test2),'Agent::TCLI::Parameter','new test2 object');
# Test name accessor-mutator methods
is($test1->name,'test1', '$test1->name accessor from init args');
ok($test2->name('test2'),'$test2->name mutator ');
is($test2->name,'test2', '$test2->name accessor from mutator');
# Test aliases accessor/mutator methods
is($test1->aliases,'t1', '$test1->aliases from init args');
ok($test2->aliases('i1'),'$test2->aliases init mutator');
is($test2->aliases,'i1', '$test2->aliases accessor');
# Test constraints accessor/mutator methods
is_deeply($test1->constraints,['ASCII'], '$test1->constraints from init args');
ok($test2->constraints(['INT']),'$test2->constraints init mutator');
is_deeply($test2->constraints,['INT'], '$test2->constraints accessor');
# Test help accessor/mutator methods
is($test1->help,'text for a parameter', '$test1->help from init args');
ok($test2->help('int for a parameter'),'$test2->help init mutator ');
is($test2->help,'int for a parameter', '$test2->help accessor');
# Test manual accessor/mutator methods
is($test1->manual,'This parameter is used for testing the module.', '$test1->manual from init args');
# for init 'manual' => 'This parameter is used for testing the module.',
ok($test2->manual('This parameter is used for testing the module.'),'$test2->manual init mutator');
is($test2->manual,'This parameter is used for testing the module.', '$test2->manual accessor');
( run in 1.296 second using v1.01-cache-2.11-cpan-39bf76dae61 )