Skip to content

Commit

Permalink
parameters are ordered alphabetically
Browse files Browse the repository at this point in the history
... which is not what one would expect. I would rather think that
parameters should be taken in the order in which they are
declared, or following a 'position' attribute.
  • Loading branch information
yanick committed Apr 2, 2013
1 parent b068d0c commit 7073ef7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 7 additions & 4 deletions t/05_extended.t
Expand Up @@ -150,16 +150,19 @@ subtest 'Test positional params' => sub {
local @ARGV = qw(extra hui --value baer);
my $test12 = Test03->new_with_command;
isa_ok($test12,'Test03::ExtraCommand');
is($test12->extra1,'hui','Extra1 value is undef');
is($test12->extra1,'hui','Extra1 value is "hui"');
is($test12->extra2, undef,'Extra2 value is undef');
is($test12->alpha, undef,'alpha value is undef');
is($test12->value,'baer','Value is set');
};

subtest 'Test optional positional params' => sub {
local @ARGV = qw(extra hui 11 --value baer);
my $test12 = Test03->new_with_command;
isa_ok($test12,'Test03::ExtraCommand');
is($test12->extra1,'hui','Extra1 value is undef');
is($test12->extra2,11,'Extra2 value is undef');
is($test12->extra1,'hui','Extra1 value is "hui"');
is($test12->extra2,11,'Extra2 value is "11"');
is($test12->alpha, undef,'alpha value is undef');
is($test12->value,'baer','Value is set');
};

Expand All @@ -178,4 +181,4 @@ subtest 'Test missing positional params' => sub {
my $test13 = Test03->new_with_command;
isa_ok($test13,'MooseX::App::Message::Envelope');
is($test13->blocks->[0]->header,"Required parameter 'extra1' missing","Message ok");
};
};
7 changes: 6 additions & 1 deletion t/testlib/Test03/ExtraCommand.pm
Expand Up @@ -14,6 +14,11 @@ parameter 'extra2' => (
isa => 'Int',
);

parameter 'alpha' => (
is => 'rw',
isa => 'Int',
);

option 'value' => (
is => 'rw',
isa => 'Str',
Expand All @@ -30,4 +35,4 @@ sub run {
}
}

1;
1;

0 comments on commit 7073ef7

Please sign in to comment.