File: current_shell.t

package info (click to toggle)
perlbrew 1.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 752 kB
  • sloc: perl: 9,387; makefile: 7; sh: 1
file content (24 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env perl
use Test2::V0;
use App::perlbrew;

plan 6;

my $current_shell = (split("/", $ENV{SHELL}))[-1];
my $self = App::perlbrew->new();
is($self->current_shell(), $current_shell, 'current_shell gives the expected shell based on $SHELL environment variable') or diag("\$SHELL = $ENV{SHELL}");
is($self->current_shell('foobar'), 'foobar', 'current_shell setups and returns anything passed as parameter');

for my $shell (qw(bash zsh)) {
    note("Testing with $shell");
    $self->current_shell($shell);
    ok($self->current_shell_is_bashish(), 'current_shell_is_bashish() returns true if the current shell is Bash or based on it');
}


for my $shell (qw(ksh sh)) {
    note("Testing with $shell");
    $self->current_shell($shell);
    ok( (! $self->current_shell_is_bashish()), 'current_shell_is_bashish() returns false');
}