No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / atf / dist / tests / bootstrap / t_application_opts_args.at
blob7cf1e634ea7d616e81909a62094f089e1bb8cf7d
1 dnl
2 dnl Automated Testing Framework (atf)
3 dnl
4 dnl Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
5 dnl All rights reserved.
6 dnl
7 dnl Redistribution and use in source and binary forms, with or without
8 dnl modification, are permitted provided that the following conditions
9 dnl are met:
10 dnl 1. Redistributions of source code must retain the above copyright
11 dnl    notice, this list of conditions and the following disclaimer.
12 dnl 2. Redistributions in binary form must reproduce the above copyright
13 dnl    notice, this list of conditions and the following disclaimer in the
14 dnl    documentation and/or other materials provided with the distribution.
15 dnl
16 dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17 dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21 dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 dnl
30 AT_SETUP([application: arguments and options handling])
32 dnl Check that an application that does not redefine any method does
33 dnl not show strange flags in the usage message.
34 AT_CHECK([APP_HELPER(app_empty) -h], 0, [stdout], [])
35 AT_CHECK([grep ' -d ' stdout], 1, [ignore], [])
36 AT_CHECK([grep ' -h ' stdout], 0, [ignore], [])
37 AT_CHECK([grep ' -v ' stdout], 1, [ignore], [])
38 AT_CHECK([grep ' -z ' stdout], 1, [ignore], [])
40 dnl Check that an application that adds its own options shows them in
41 dnl the usage message.
42 AT_CHECK([APP_HELPER(app_opts_args) -h], 0, [stdout], [])
43 AT_CHECK([grep ' -d ' stdout], 0, [ignore], [])
44 AT_CHECK([grep ' -h ' stdout], 0, [ignore], [])
45 AT_CHECK([grep ' -v ' stdout], 0, [ignore], [])
46 AT_CHECK([grep ' -z ' stdout], 1, [ignore], [])
48 dnl Check that an application that does not redefine any method does
49 dnl not recognize strange flags.
50 AT_CHECK([APP_HELPER(app_empty) -d], 1, [], [stderr])
51 AT_CHECK([grep 'Unknown option.*-d' stderr], 0, [ignore], [])
52 AT_CHECK([APP_HELPER(app_empty) -v], 1, [], [stderr])
53 AT_CHECK([grep 'Unknown option.*-v' stderr], 0, [ignore], [])
54 AT_CHECK([APP_HELPER(app_empty) -z], 1, [], [stderr])
55 AT_CHECK([grep 'Unknown option.*-z' stderr], 0, [ignore], [])
57 dnl Check that an application that adds its own options is able to
58 dnl properly handle them.
59 AT_CHECK([APP_HELPER(app_opts_args) -d], 0, [stdout], [])
60 AT_CHECK([grep -- '-d given' stdout], 0, [ignore], [])
61 AT_CHECK([APP_HELPER(app_opts_args) -v], 1, [], [stderr])
62 AT_CHECK([grep 'Option.*-v.*requires an argument' stderr], 0, [ignore], [])
63 AT_CHECK([APP_HELPER(app_opts_args) -v foo], 0, [stdout], [])
64 AT_CHECK([grep -- '-v given with argument foo' stdout], 0, [ignore], [])
65 AT_CHECK([APP_HELPER(app_opts_args) -z], 1, [], [stderr])
66 AT_CHECK([grep 'Unknown option.*-z' stderr], 0, [ignore], [])
68 dnl Check that option processing stops after an argument.
69 AT_CHECK([APP_HELPER(app_opts_args) -- -d], 0, [stdout], [])
70 AT_CHECK([grep -- '-d given' stdout], 1, [], [])
71 AT_CHECK([APP_HELPER(app_opts_args) arg -d], 0, [stdout], [])
72 AT_CHECK([grep -- '-d given' stdout], 1, [], [])
74 dnl Check that an application that does not redefine any method does
75 dnl not show unexpected arguments in the usage message.
76 AT_CHECK([APP_HELPER(app_empty) -h], 0, [stdout], [])
77 AT_CHECK([grep '\@<:@options\@:>@$' stdout], 0, [ignore], [])
79 dnl Check that an application that defines the arguments it takes
80 dnl shows them in the usage message.
81 AT_CHECK([APP_HELPER(app_opts_args) -h], 0, [stdout], [])
82 AT_CHECK([grep '\@<:@options\@:>@ <arg1> <arg2>' stdout], 0, [ignore], [])
84 AT_CLEANUP()
86 dnl vim: syntax=m4:expandtab:shiftwidth=4:softtabstop=4