diff options
| author | christos <christos@NetBSD.org> | 2023-02-20 15:47:56 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2023-02-20 15:47:56 +0000 |
| commit | 1f89ce7ee0b1686ce188271df9c01790c38d4065 (patch) | |
| tree | 2d45d3bda7f401ac9d39a4d5dfec106e9298c3b9 /tests/lib | |
| parent | 5305eb5c85de7eeee223d0f9c4563f3ddd94f289 (diff) | |
New optval test from des @ FreeBSD
Diffstat (limited to 'tests/lib')
| -rw-r--r-- | tests/lib/libc/stdlib/t_getopt.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/lib/libc/stdlib/t_getopt.sh b/tests/lib/libc/stdlib/t_getopt.sh index cc10f652543..f10feddca35 100644 --- a/tests/lib/libc/stdlib/t_getopt.sh +++ b/tests/lib/libc/stdlib/t_getopt.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_getopt.sh,v 1.1 2011/01/01 23:56:49 pgoyette Exp $ +# $NetBSD: t_getopt.sh,v 1.2 2023/02/20 15:47:56 christos Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -65,6 +65,18 @@ getopt_body() h_getopt "${load}" "foo -d - 1" "d|2" } +atf_test_case getopt_optval +getopt_optval() +{ + atf_set "descr" "Checks getopt(3) with optional value" +} +getopt_optval_body() +{ + h_getopt "o::" "foo -o" "o=(null)|0" + h_getopt "o::" "foo -o1 2" "o=1|1" + h_getopt "o::" "foo -o 1 2" "o=(null)|2" +} + atf_test_case getopt_long getopt_long_head() { @@ -119,5 +131,6 @@ longopt: list, no_argument, lopt, 'l'" atf_init_test_cases() { atf_add_test_case getopt + atf_add_test_case getopt_optval atf_add_test_case getopt_long } |
