Skip to content

Commit

Permalink
test command lists
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 17, 2015
1 parent f82d416 commit 959c02e
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions t/mojolicious/commands.t
Expand Up @@ -89,9 +89,18 @@ is $app->start('test_command'), 'works!', 'right result';
ok $commands->description, 'has a description';
like $commands->message, qr/COMMAND/, 'has a message';
like $commands->hint, qr/help/, 'has a hint';
my $buffer = '';
{
open my $handle, '>', \$buffer;
local *STDOUT = $handle;
local $ENV{HARNESS_ACTIVE} = 0;
$commands->run;
}
like $buffer, qr/Usage: APPLICATION COMMAND \[OPTIONS\].*daemon.*version/s,
'right output';

# help
my $buffer = '';
$buffer = '';
{
open my $handle, '>', \$buffer;
local *STDOUT = $handle;
Expand Down Expand Up @@ -151,7 +160,17 @@ require Mojolicious::Command::generate;
my $generator = Mojolicious::Command::generate->new;
ok $generator->description, 'has a description';
like $generator->message, qr/generate/, 'has a message';
like $commands->hint, qr/help/, 'has a hint';
like $generator->hint, qr/help/, 'has a hint';
$buffer = '';
{
open my $handle, '>', \$buffer;
local *STDOUT = $handle;
local $ENV{HARNESS_ACTIVE} = 0;
$generator->run;
}
like $buffer,
qr/Usage: APPLICATION generate GENERATOR \[OPTIONS\].*lite_app.*plugin/s,
'right output';

# generate app
require Mojolicious::Command::generate::app;
Expand Down

0 comments on commit 959c02e

Please sign in to comment.