Agent-TCLI

 view release on metacpan or  search on metacpan

t/TCLI.Control.t  view on Meta::CPAN

[qw( test1 test1.1 test1.1.1 exit ) ],
);
$test1->context( 'ROOT' );
#$test1->verbose(3);
foreach my $args ( @input )
{
	my @targs = @{$args};
	($tcmd,$preargs,$ttxt) = $test1->FindCommand($args);
	$test1->Verbose( " tcmd(".$tcmd->name.") ttxt($ttxt) context(".$test1->print_context.") preargs dump \n",1,$preargs);
	is($ttxt,'', 'Found cmd '.join(' ', @targs ));
	is($tcmd->name,'exit', 'Name is exit ' );
}
#$test1->verbose(0);

# Need to test all in test_all
@input = (
[qw( test_all one ) ],
[qw( test_all two ) ],
[qw( test_all three ) ],
[qw( test_all one two) ],
[qw( test_all one two three) ],
[qw( test_all three two one) ],
);
$test1->context( 'ROOT' );
#$test1->verbose(3);
foreach my $args ( @input )
{
	my @targs = @{$args};
	($tcmd,$preargs,$ttxt) = $test1->FindCommand($args);
	$test1->Verbose( " tcmd(".$tcmd->name.") ttxt($ttxt) context(".$test1->print_context.") preargs dump \n",1,$preargs);
	is($ttxt,'', 'Found for '.join(' ', @targs ));
	is($tcmd->name,'all', 'Name is all ' );
}
#$test1->verbose(0);

# General Automethod tests

ok($test1->set_test('test'),'$test1->set_test');
is($test1->get_test,'test','$test1->get_test');

ok($test1->set_myarray(['one'] ),'$test1->set_myarray autoload ');
is_deeply($test1->get_myarray,['one'] , '$test1->get_myarray  autoload');

ok($test1->push_myarray('two','three'), '$test1->push_myarray ');
is_deeply($test1->get_myarray,['one', 'two', 'three', ], '$test1->get_myarray ');

ok($test1->push_myarray('four'), '$test1->push_myarray ');
is_deeply($test1->get_myarray,['one', 'two', 'three', 'four', ], '$test1->get_myarray');
is($test1->depth_myarray,4, '$test1->depth_myarray ');

is($test1->shift_myarray(),'one','$test1->shift_myarray ');
is_deeply($test1->get_myarray,[ 'two', 'three', 'four', ], '$test1->get_myarray');
is($test1->depth_myarray,3, '$test1->depth_myarray ');
is($test1->print_myarray,'two three four', '$test1->print_myarray');

ok($test1->unshift_myarray('one'), '$test1->unshift_myarray ');
is_deeply($test1->get_myarray,['one', 'two', 'three', 'four', ], '$test1->get_myarray');
is($test1->depth_myarray,4, '$test1->depth_myarray ');

# tests for empty arrays and automethods
is($test1->get_myarray2(),undef,'$test1->get_myarray2 autoload ');
is($test1->depth_myarray2,0, '$test1->depth_myarray2 ');
is($test1->print_myarray2,'', '$test1->print_myarray2');
ok($test1->push_myarray2('two','three'), '$test1->push_myarray2 ');
is_deeply($test1->get_myarray2,[ 'two', 'three', ], '$test1->get_myarray2 ');

is($test1->get_myarray3(),undef,'$test1->get_myarray3 autoload ');
is($test1->shift_myarray3(),undef,'$test1->shift_myarray3 ');
is($test1->pop_myarray3(),undef,'$test1->pop_myarray3 ');
ok($test1->unshift_myarray3('two','three'), '$test1->push_myarray3 ');
is_deeply($test1->get_myarray3,[ 'two', 'three', ], '$test1->get_myarray3 ');


$poe_kernel->run;



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