Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arthur Axel 'fREW' Schmidt
committed
Aug 10, 2012
1 parent
6bd4104
commit 2bb72e6
Showing
6 changed files
with
292 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,98 @@ | |||
#!/usr/bin/env perl | |||
|
|||
use 5.14.1; | |||
use warnings; | |||
|
|||
use Test::More; | |||
use App::Cmd::Tester; | |||
|
|||
use lib 't/lib'; | |||
|
|||
use A 'stdout_is'; | |||
|
|||
my $app = A->app; | |||
|
|||
local $ENV{PATH} = 't/editors:' . $ENV{PATH}; | |||
|
|||
subtest 'ls' => sub { | |||
my $result = test_app($app => [qw(drink ls)]); | |||
stdout_is($result, [ | |||
'* Tom Collins', | |||
'* Cuba Libre', | |||
'* Frewba Libre', | |||
]); | |||
}; | |||
|
|||
subtest 'new' => sub { | |||
local $ENV{EDITOR} = 'drink-new-1'; | |||
my $result = test_app($app => [qw(drink new frew)]); | |||
stdout_is($result, [ | |||
'## Awesome bevvy', | |||
'', | |||
'## Ingredients', | |||
'', | |||
' * 4 ounces of ice', | |||
'', | |||
'## Description', | |||
'', | |||
"YUMM", | |||
'', | |||
q(Source: Boy's Life), | |||
'', | |||
'', | |||
'drink (Awesome bevvy) created', | |||
]); | |||
}; | |||
|
|||
subtest 'new --based_on' => sub { | |||
local $ENV{EDITOR} = 'drink-new-based-on'; | |||
my $result = test_app($app => [qw(drink new --based_on), 'Awesome bevvy']); | |||
stdout_is($result, [ | |||
'## silly new name', | |||
'', | |||
'## Ingredients', | |||
'', | |||
' * 4 ounces of ice', | |||
'', | |||
'## Description', | |||
'', | |||
"YUMM", | |||
'', | |||
q(Variant of Awesome bevvy), | |||
'', | |||
q(Source: Boy's Life), | |||
'', | |||
'', | |||
'drink (silly new name) created', | |||
]); | |||
}; | |||
|
|||
subtest 'rm' => sub { | |||
my $result = test_app($app => [qw(drink rm), 'tom*']); | |||
stdout_is($result, ["drink (Tom Collins) deleted"], 'simple deletion works'); | |||
}; | |||
|
|||
subtest 'edit' => sub { | |||
local $ENV{EDITOR} = 'drink-edit-1'; | |||
my $result = test_app($app => [qw(drink edit), 'frewba libre']); | |||
stdout_is($result, [ | |||
'## Frewba Libre', | |||
'', | |||
'## Ingredients', | |||
'', | |||
'', | |||
'## Description', | |||
'', | |||
"A Delicious beverage of frew's own design", | |||
'', | |||
'Variant of Cuba Libre', | |||
'', | |||
'Source: TV Guide wtf?', | |||
'', | |||
'', | |||
'drink (Frewba Libre) updated', | |||
]); | |||
}; | |||
|
|||
done_testing; | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,34 @@ | |||
#!/usr/bin/env perl | |||
|
|||
use 5.14.1; | |||
use warnings; | |||
|
|||
use Test::More; | |||
use App::Cmd::Tester; | |||
|
|||
use lib 't/lib'; | |||
|
|||
use A 'stdout_is'; | |||
|
|||
my $app = A->app; | |||
|
|||
local $ENV{PATH} = 't/editors:' . $ENV{PATH}; | |||
|
|||
local $TODO = q(App::Cmd can't test help for subcommands?); | |||
my $result = test_app($app => [qw(drink help)]); | |||
stdout_is($result, [ | |||
'app.t <command>', | |||
'', | |||
'Available commands:', | |||
'', | |||
q( commands: list the application's commands), | |||
q( help: display a command's help screen), | |||
'', | |||
' drink: interact with drinks', | |||
'ingredient: interact with ingredients', | |||
' inventory: interact with inventory', | |||
' maint: ', | |||
'', | |||
]); | |||
|
|||
done_testing; |
Oops, something went wrong.