From: Vincent Pit Date: Sun, 5 Oct 2008 22:12:23 +0000 (+0200) Subject: Test setting an action X-Git-Tag: v0.02~6 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=2e22285568ea8e99ddd04a0a530cc39371f57ac7;p=perl%2Fmodules%2Frgit.git Test setting an action --- diff --git a/t/15-failures.t b/t/15-failures.t index 46d2d32..5270045 100644 --- a/t/15-failures.t +++ b/t/15-failures.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 30; +use Test::More tests => 34; use App::Rgit; @@ -59,11 +59,11 @@ isa_ok($res, 'App::Rgit::Test::Foo', 'App::Rgit::Test::Foo->App::Rgit::Command:: $res = eval { App::Rgit::Command->action('version') }; is($@, '', 'App::Rgit::Command->action("version"): does not croak'); -is($res, 'App::Rgit::Command::Once', 'App::Rgit::Command->action("version"): returns valid object'); +is($res, 'App::Rgit::Command::Once', 'App::Rgit::Command->action("version"): returns valid answer'); $res = eval { App::Rgit::Command->new(cmd => 'version')->action() }; is($@, '', 'App::Rgit::Command->action(): does not croak'); -is($res, 'App::Rgit::Command::Once', 'App::Rgit::Command->action(): returns valid object'); +is($res, 'App::Rgit::Command::Once', 'App::Rgit::Command->action(): returns valid answer'); $res = eval { App::Rgit::Command->action() }; is($@, '', 'App::Rgit::Command->action(): no cmd: does not croak'); @@ -77,3 +77,12 @@ $res = bless { }, 'App::Rgit::Test::Monkey'; $res = eval { $res->App::Rgit::Command::action() }; is($@, '', 'App::Rgit::Test::Monkey->App::Rgit::Command::action(): no cmd: does not croak'); is($res, undef, 'App::Rgit::Test::Monkey->App::Rgit::Command::action(); no cmd: returns undef'); + +$res = eval { App::Rgit::Command->action('beer' => 'App::Rgit::Test::Pub') }; +is($@, '', 'App::Rgit::Command->action("beer" => "App::Rgit::Test::Pub"): does not croak'); +is($res, 'App::Rgit::Test::Pub', 'App::Rgit::Command->action("beer" => "App::Rgit::Test::Pub"): returns valid answer'); + +$res = eval { App::Rgit::Command->action('beer') }; +is($@, '', 'App::Rgit::Command->action("beer"): does not croak'); +is($res, 'App::Rgit::Test::Pub', 'App::Rgit::Command->action("beer"): returns valid answer'); +