diff options
Diffstat (limited to 'xt/cli/cpanfile.t')
-rw-r--r-- | xt/cli/cpanfile.t | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/xt/cli/cpanfile.t b/xt/cli/cpanfile.t new file mode 100644 index 0000000..b663b37 --- /dev/null +++ b/xt/cli/cpanfile.t @@ -0,0 +1,44 @@ +use strict; +use Test::More; +use xt::CLI; + +subtest 'carton install --cpanfile' => sub { + my $app = cli(); + $app->write_file('cpanfile.foo', <<EOF); +requires 'Try::Tiny', '== 0.11'; +EOF + $app->run("install", "--cpanfile", "cpanfile.foo"); + $app->run("check", "--cpanfile", "cpanfile.foo"); + + ok !$app->dir->child('cpanfile.snapshot')->exists; + ok $app->dir->child('cpanfile.foo.snapshot')->exists; + + like $app->stdout, qr/are satisfied/; + + local $ENV{PERL_CARTON_CPANFILE} = $app->dir->child('cpanfile.foo')->absolute; + + $app->run("list"); + like $app->stdout, qr/Try-Tiny-0\.11/; + + $app->run("exec", "perl", "-e", "use Try::Tiny\ 1"); + like $app->stderr, qr/Try::Tiny .* 0\.11/; +}; + +subtest 'PERL_CARTON_CPANFILE' => sub { + my $app = cli(); + + local $ENV{PERL_CARTON_CPANFILE} = $app->dir->child('cpanfile.foo')->absolute; + + $app->write_file('cpanfile.foo', <<EOF); +requires 'Try::Tiny', '== 0.11'; +EOF + + $app->run("install"); + $app->run("list"); + + like $app->stdout, qr/Try-Tiny-0\.11/; + ok $app->dir->child('cpanfile.foo.snapshot')->exists; +}; + +done_testing; + |