File: 09.exit_status.t

package info (click to toggle)
perlbrew 0.78-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 708 kB
  • sloc: perl: 6,291; makefile: 6
file content (32 lines) | stat: -rw-r--r-- 607 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env perl
use strict;
use warnings;

use FindBin;
use lib $FindBin::Bin;
use App::perlbrew;
require 'test_helpers.pl';

use Test::More;
use Test::Exception;
use Path::Class;

my $bin_perlbrew = $ENV{ADTTMP} ? '/usr/bin/perlbrew' : file(__FILE__)->dir->parent->subdir("bin")->file("perlbrew");

throws_ok(
    sub {
        my $app = App::perlbrew->new("unknown-command");
        $app->run;
    },
    qr[unknown-command]
);

my $perl = $^X;
system("$perl -Ilib ${bin_perlbrew} unknown-command 2>&1");
ok($? != 0);

system("$perl -Ilib ${bin_perlbrew} version 2>&1");
ok($? == 0);

done_testing;