File: 20expect_quit.t

package info (click to toggle)
libshell-perl-perl 0.0026-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 168 kB
  • ctags: 56
  • sloc: perl: 458; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 683 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

use Test::More;

eval "use Test::Expect";
plan skip_all => "Test::Expect required for testing" if $@;

# test pirl and its many quit commands

plan( tests => 2*6 );

unless ($ENV{TERM}) {    # help when TERM is not setup
    diag qq{TERM not set, using "dumb"};
    $ENV{TERM} = 'dumb';
}

for my $quit_command ( ':quit', ':q', ':exit', ':x', 'exit', 'quit' ) {

    expect_run(
        command => "$^X -Mblib blib/script/pirl --noornaments",
        prompt  => 'pirl @> ',
        quit    => $quit_command,
    );

    expect_like(
        qr/\A
           (?: Using .*? blib \n )?   # cope with noisy 5.6 blib
           Welcome
          /msx,
        "welcome message"
   );

}