source:
branches/UKMO/dev_r5518_ciceiau/NEMOGCM/EXTERNAL/fcm/t/Fcm/CLI/Invoker.t
@
6297
Last change on this file since 6297 was 2281, checked in by smasson, 14 years ago | |
---|---|
|
|
File size: 969 bytes |
Line | |
---|---|
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More qw{no_plan}; |
7 | |
8 | main(); |
9 | |
10 | sub main { |
11 | my $class = 'Fcm::CLI::Invoker'; |
12 | use_ok($class); |
13 | test_normal($class); |
14 | } |
15 | |
16 | ################################################################################ |
17 | # Tests normal usage |
18 | sub test_normal { |
19 | my ($class) = @_; |
20 | my $prefix = "normal"; |
21 | my %OPTIONS = (option1 => 1, option2 => 2, option3 => 3); |
22 | my @ARGUMENTS = ('argument 1', 'argument 2'); |
23 | my $invoker = $class->new({ |
24 | command => 'command', |
25 | options => \%OPTIONS, |
26 | arguments => \@ARGUMENTS, |
27 | }); |
28 | isa_ok($invoker, $class, $prefix); |
29 | is($invoker->get_command(), 'command', "$prefix: command"); |
30 | is_deeply({$invoker->get_options()}, \%OPTIONS, "$prefix: options"); |
31 | is_deeply([$invoker->get_arguments()], \@ARGUMENTS, "$prefix: arguments"); |
32 | eval { |
33 | $invoker->invoke(); |
34 | }; |
35 | isa_ok($@, 'Fcm::CLI::Exception', "$prefix: invoke"); |
36 | } |
37 | |
38 | __END__ |
Note: See TracBrowser
for help on using the repository browser.