2458 |
03 Apr 11 |
peter |
#! /bin/sh |
2458 |
03 Apr 11 |
peter |
# $Id$ |
2458 |
03 Apr 11 |
peter |
3 |
# |
4207 |
26 Aug 22 |
peter |
# Copyright (C) 2011, 2012, 2013, 2022 Peter Johansson |
2458 |
03 Apr 11 |
peter |
5 |
# |
2458 |
03 Apr 11 |
peter |
# This file is part of the yat library, http://dev.thep.lu.se/yat |
2458 |
03 Apr 11 |
peter |
7 |
# |
2458 |
03 Apr 11 |
peter |
# The yat library is free software; you can redistribute it |
2458 |
03 Apr 11 |
peter |
# and/or modify it under the terms of the GNU General Public License as |
2458 |
03 Apr 11 |
peter |
# published by the Free Software Foundation; either version 3 of the |
2458 |
03 Apr 11 |
peter |
# License, or (at your option) any later version. |
2458 |
03 Apr 11 |
peter |
12 |
# |
2458 |
03 Apr 11 |
peter |
# The yat library is distributed in the hope that it will be useful, |
2458 |
03 Apr 11 |
peter |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2458 |
03 Apr 11 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2458 |
03 Apr 11 |
peter |
# General Public License for more details. |
2458 |
03 Apr 11 |
peter |
17 |
# |
2458 |
03 Apr 11 |
peter |
# You should have received a copy of the GNU General Public License |
2458 |
03 Apr 11 |
peter |
# along with yat. If not, see <http://www.gnu.org/licenses/>. |
2458 |
03 Apr 11 |
peter |
20 |
|
2458 |
03 Apr 11 |
peter |
21 |
|
2458 |
03 Apr 11 |
peter |
# test that --help is detected also in presence of invalid arguments |
2458 |
03 Apr 11 |
peter |
23 |
|
2458 |
03 Apr 11 |
peter |
24 |
set -e |
2458 |
03 Apr 11 |
peter |
25 |
|
3036 |
03 Jun 13 |
peter |
26 |
. test/init.sh || exit 99 |
2458 |
03 Apr 11 |
peter |
27 |
|
4153 |
09 Mar 22 |
peter |
28 |
prog=../../stdopt |
4153 |
09 Mar 22 |
peter |
29 |
run $prog 0 --nonsense --help |
2520 |
11 Jul 11 |
peter |
30 |
test -s stderr && exit_fail |
2520 |
11 Jul 11 |
peter |
31 |
grep 'Usage:' stdout || exit_fail |
2458 |
03 Apr 11 |
peter |
32 |
|
4153 |
09 Mar 22 |
peter |
33 |
run $prog 0 -nonsense --help |
2520 |
11 Jul 11 |
peter |
34 |
test -s stderr && exit_fail |
2520 |
11 Jul 11 |
peter |
35 |
grep 'Usage:' stdout || exit_fail |
2458 |
03 Apr 11 |
peter |
36 |
|
4153 |
09 Mar 22 |
peter |
37 |
run $prog 0 nonsense --help |
2520 |
11 Jul 11 |
peter |
38 |
test -s stderr && exit_fail |
2520 |
11 Jul 11 |
peter |
39 |
grep 'Usage:' stdout || exit_fail |
2458 |
03 Apr 11 |
peter |
40 |
|
4153 |
09 Mar 22 |
peter |
41 |
run $prog 1 --help-me |
2520 |
11 Jul 11 |
peter |
42 |
test -s stderr || exit_fail |
4153 |
09 Mar 22 |
peter |
43 |
grep 'stdopt:.*help-me' stderr || exit_fail |
2458 |
03 Apr 11 |
peter |
44 |
|
2520 |
11 Jul 11 |
peter |
45 |
exit_success |