xref: /freebsd/usr.bin/locale/tests/locale_test.sh (revision 42249ef2)
1#
2# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3#
4# Copyright 2019 Yuri Pankov
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27# $FreeBSD$
28
29atf_test_case k_flag_posix
30k_flag_posix_head()
31{
32	atf_set "descr" "Verify -k handles all POSIX specified keywords"
33}
34k_flag_posix_body()
35{
36	export LC_ALL="C"
37
38	# LC_MONETARY
39	atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_monetary.out" \
40	    locale -k \
41	    int_curr_symbol \
42	    currency_symbol \
43	    mon_decimal_point \
44	    mon_thousands_sep \
45	    mon_grouping \
46	    positive_sign \
47	    negative_sign \
48	    int_frac_digits \
49	    frac_digits \
50	    p_cs_precedes \
51	    p_sep_by_space \
52	    n_cs_precedes \
53	    n_sep_by_space \
54	    p_sign_posn \
55	    n_sign_posn \
56	    int_p_cs_precedes \
57	    int_n_cs_precedes \
58	    int_p_sep_by_space \
59	    int_n_sep_by_space \
60	    int_p_sign_posn \
61	    int_n_sign_posn
62
63	# LC_NUMERIC
64	atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_numeric.out" \
65	    locale -k \
66	    decimal_point \
67	    thousands_sep \
68	    grouping
69
70	# LC_TIME
71	atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_time.out" \
72	    locale -k \
73	    abday \
74	    day \
75	    abmon \
76	    mon \
77	    d_t_fmt \
78	    d_fmt \
79	    t_fmt \
80	    am_pm \
81	    t_fmt_ampm \
82	    era \
83	    era_d_fmt \
84	    era_t_fmt \
85	    era_d_t_fmt \
86	    alt_digits
87
88	# LC_MESSAGES
89	atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_messages.out" \
90	    locale -k \
91	    yesexpr \
92	    noexpr
93}
94
95atf_init_test_cases()
96{
97	atf_add_test_case k_flag_posix
98}
99