File: errors-t

package info (click to toggle)
kstart 4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,884 kB
  • sloc: ansic: 5,937; sh: 4,785; perl: 2,130; makefile: 142
file content (41 lines) | stat: -rwxr-xr-x 1,256 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
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl -w
#
# Tests for error handling in k5start.
#
# Written by Russ Allbery <eagle@eyrie.org>
# Copyright 2021 Russ Allbery <eagle@eyrie.org>
# Copyright 2011
#     The Board of Trustees of the Leland Stanford Junior University
#
# SPDX-License-Identifier: MIT

use Test::More;

# The full path to the newly-built k5start client.
our $K5START = "$ENV{C_TAP_BUILD}/../commands/k5start";

# Load our test utility programs.
require "$ENV{C_TAP_SOURCE}/libtest.pl";

# Don't overwrite the user's ticket cache.
$ENV{KRB5CCNAME} = 'krb5cc_test';

# Test invalid options.
our @OPTIONS = (
    [ [ qw/-H 0/        ], '-H limit argument 0 invalid' ],
    [ [ qw/-H -1/       ], '-H limit argument -1 invalid' ],
    [ [ qw/-H 4foo/     ], '-H limit argument 4foo invalid' ],
    [ [ qw/-K 4foo/     ], '-K interval argument 4foo invalid' ],
    [ [ qw/-H4 -Uf a a/ ], '-H option cannot be used with a command' ]
);

# Test plan.
plan tests => scalar (@OPTIONS) * 3;

# Run the invalid option tests.
for my $opt (@OPTIONS) {
    my ($out, $err, $status) = command ($K5START, @{ $opt->[0] });
    is ($status, 1, "k5start @{ $opt->[0] } fails");
    is ($out, '', ' with no output');
    is ($err, 'k5start: ' . $opt->[1] . "\n", ' and correct error');
}