Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/stdlib New optval test from des @ FreeBSD



details:   https://anonhg.NetBSD.org/src/rev/46417fb2d946
branches:  trunk
changeset: 373603:46417fb2d946
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Feb 20 15:47:56 2023 +0000

description:
New optval test from des @ FreeBSD

diffstat:

 tests/lib/libc/stdlib/t_getopt.sh |  15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diffs (35 lines):

diff -r bf8dd159629a -r 46417fb2d946 tests/lib/libc/stdlib/t_getopt.sh
--- a/tests/lib/libc/stdlib/t_getopt.sh Mon Feb 20 13:30:47 2023 +0000
+++ b/tests/lib/libc/stdlib/t_getopt.sh Mon Feb 20 15:47:56 2023 +0000
@@ -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 @@
        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 @@
 atf_init_test_cases()
 {
        atf_add_test_case getopt
+       atf_add_test_case getopt_optval
        atf_add_test_case getopt_long
 }



Home | Main Index | Thread Index | Old Index