[carton] 315/472: carton exec without an argument should die
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:59 UTC 2015
This is an automated email from the git hooks/post-receive script.
kanashiro-guest pushed a commit to branch master
in repository carton.
commit 7d748501504db75b41f01f793fa2681813b8e5af
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date: Sat Jun 8 14:27:00 2013 -0700
carton exec without an argument should die
---
lib/Carton/CLI.pm | 4 ++++
xt/cli/exec.t | 17 +++++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index e91aec4..3da3b54 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -357,6 +357,10 @@ sub cmd_exec {
$self->parse_options_pass_through(\@args, 'I=s@', sub { die "exec -Ilib is deprecated.\n" });
+ unless (@args) {
+ $self->error("carton exec needs a command to run.");
+ }
+
# PERL5LIB takes care of arch
my $path = $self->install_path;
local $ENV{PERL5LIB} = "$path/lib/perl5";
diff --git a/xt/cli/exec.t b/xt/cli/exec.t
index b56b241..f1487af 100644
--- a/xt/cli/exec.t
+++ b/xt/cli/exec.t
@@ -2,14 +2,23 @@ use strict;
use Test::More;
use xt::CLI;
-{
+subtest 'carton exec without a command', sub {
+ my $app = cli();
+ $app->write_cpanfile('');
+ $app->run("install");
+ $app->run("exec");
+ like $app->stderr, qr/carton exec needs a command/;
+ is $app->exit_code, 255;
+};
+
+subtest 'exec without a lock', sub {
my $app = cli();
$app->run("exec", "perl", "-e", 1);
like $app->stderr, qr/carton\.lock/;
is $app->exit_code, 255;
-}
+};
-{
+subtest 'carton exec', sub {
my $app = cli();
$app->write_cpanfile('');
$app->run("install");
@@ -44,7 +53,7 @@ EOF
$app->run("exec", "--", "mojo", "version");
like $app->stdout, qr/Mojolicious \(4\.01/;
-}
+};
done_testing;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git
More information about the Pkg-perl-cvs-commits
mailing list