File: simple-help.t

package info (click to toggle)
libapp-cmd-perl 0.338-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 516 kB
  • sloc: perl: 1,727; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 772 bytes parent folder | download | duplicates (3)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!perl
use strict;
use warnings;

use Test::More;
use App::Cmd::Tester;

use lib 't/lib';

use Test::MySimple;

my $return = test_app('Test::MySimple', [ qw(--help) ]);

my $stdout = $return->stdout;

like(
    $stdout,
    qr/\S/,
    "Our simple app prints some help text.",
);

like(
    $stdout,
    qr/\[-f\]\s+\[long options\.\.\.\]/,
    "Our simple app prints a usage message",
);

{
  my @want = ('-f', '--fooble', 'check all foobs for foobling');
  my @lines = split /\n/, $stdout;

  my $got;
  for my $line (@lines) {
    index($line, $_) == -1 && next for @want;
    $got++;
  }

  ok($got, "there's a line in help fully describing --fooble");
}

unlike(
    $stdout,
    qr/commands/i,
    "Our simple app doesn't talk about subcommands",
);

done_testing()