142249ef2SYuri Pankov# 2*4d846d26SWarner Losh# SPDX-License-Identifier: BSD-2-Clause 342249ef2SYuri Pankov# 442249ef2SYuri Pankov# Copyright 2019 Yuri Pankov 542249ef2SYuri Pankov# 642249ef2SYuri Pankov# Redistribution and use in source and binary forms, with or without 742249ef2SYuri Pankov# modification, are permitted provided that the following conditions 842249ef2SYuri Pankov# are met: 942249ef2SYuri Pankov# 1. Redistributions of source code must retain the above copyright 1042249ef2SYuri Pankov# notice, this list of conditions and the following disclaimer. 1142249ef2SYuri Pankov# 2. Redistributions in binary form must reproduce the above copyright 1242249ef2SYuri Pankov# notice, this list of conditions and the following disclaimer in the 1342249ef2SYuri Pankov# documentation and/or other materials provided with the distribution. 1442249ef2SYuri Pankov# 1542249ef2SYuri Pankov# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1642249ef2SYuri Pankov# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1742249ef2SYuri Pankov# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1842249ef2SYuri Pankov# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1942249ef2SYuri Pankov# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2042249ef2SYuri Pankov# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2142249ef2SYuri Pankov# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2242249ef2SYuri Pankov# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2342249ef2SYuri Pankov# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2442249ef2SYuri Pankov# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2542249ef2SYuri Pankov# SUCH DAMAGE. 2642249ef2SYuri Pankov# 2742249ef2SYuri Pankov 2842249ef2SYuri Pankovatf_test_case k_flag_posix 2942249ef2SYuri Pankovk_flag_posix_head() 3042249ef2SYuri Pankov{ 31de96322bSYuri Pankov atf_set "descr" \ 32de96322bSYuri Pankov "Verify output of 'locale -k' for all POSIX specified keywords" 3342249ef2SYuri Pankov} 3442249ef2SYuri Pankovk_flag_posix_body() 3542249ef2SYuri Pankov{ 3642249ef2SYuri Pankov export LC_ALL="C" 3742249ef2SYuri Pankov 3842249ef2SYuri Pankov # LC_MONETARY 3942249ef2SYuri Pankov atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_monetary.out" \ 4042249ef2SYuri Pankov locale -k \ 4142249ef2SYuri Pankov int_curr_symbol \ 4242249ef2SYuri Pankov currency_symbol \ 4342249ef2SYuri Pankov mon_decimal_point \ 4442249ef2SYuri Pankov mon_thousands_sep \ 4542249ef2SYuri Pankov mon_grouping \ 4642249ef2SYuri Pankov positive_sign \ 4742249ef2SYuri Pankov negative_sign \ 4842249ef2SYuri Pankov int_frac_digits \ 4942249ef2SYuri Pankov frac_digits \ 5042249ef2SYuri Pankov p_cs_precedes \ 5142249ef2SYuri Pankov p_sep_by_space \ 5242249ef2SYuri Pankov n_cs_precedes \ 5342249ef2SYuri Pankov n_sep_by_space \ 5442249ef2SYuri Pankov p_sign_posn \ 5542249ef2SYuri Pankov n_sign_posn \ 5642249ef2SYuri Pankov int_p_cs_precedes \ 5742249ef2SYuri Pankov int_n_cs_precedes \ 5842249ef2SYuri Pankov int_p_sep_by_space \ 5942249ef2SYuri Pankov int_n_sep_by_space \ 6042249ef2SYuri Pankov int_p_sign_posn \ 6142249ef2SYuri Pankov int_n_sign_posn 6242249ef2SYuri Pankov 6342249ef2SYuri Pankov # LC_NUMERIC 6442249ef2SYuri Pankov atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_numeric.out" \ 6542249ef2SYuri Pankov locale -k \ 6642249ef2SYuri Pankov decimal_point \ 6742249ef2SYuri Pankov thousands_sep \ 6842249ef2SYuri Pankov grouping 6942249ef2SYuri Pankov 7042249ef2SYuri Pankov # LC_TIME 7142249ef2SYuri Pankov atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_time.out" \ 7242249ef2SYuri Pankov locale -k \ 7342249ef2SYuri Pankov abday \ 7442249ef2SYuri Pankov day \ 7542249ef2SYuri Pankov abmon \ 7642249ef2SYuri Pankov mon \ 7742249ef2SYuri Pankov d_t_fmt \ 7842249ef2SYuri Pankov d_fmt \ 7942249ef2SYuri Pankov t_fmt \ 8042249ef2SYuri Pankov am_pm \ 8142249ef2SYuri Pankov t_fmt_ampm \ 8242249ef2SYuri Pankov era \ 8342249ef2SYuri Pankov era_d_fmt \ 8442249ef2SYuri Pankov era_t_fmt \ 8542249ef2SYuri Pankov era_d_t_fmt \ 8642249ef2SYuri Pankov alt_digits 8742249ef2SYuri Pankov 8842249ef2SYuri Pankov # LC_MESSAGES 8942249ef2SYuri Pankov atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_messages.out" \ 9042249ef2SYuri Pankov locale -k \ 9142249ef2SYuri Pankov yesexpr \ 9242249ef2SYuri Pankov noexpr 9342249ef2SYuri Pankov} 9442249ef2SYuri Pankov 95de96322bSYuri Pankovatf_test_case no_flags_posix 96de96322bSYuri Pankovno_flags_posix_head() 97de96322bSYuri Pankov{ 98de96322bSYuri Pankov atf_set "descr" \ 99de96322bSYuri Pankov "Verify output of 'locale' for all POSIX specified keywords" 100de96322bSYuri Pankov} 101de96322bSYuri Pankovno_flags_posix_body() 102de96322bSYuri Pankov{ 103de96322bSYuri Pankov export LC_ALL="C" 104de96322bSYuri Pankov 105de96322bSYuri Pankov # LC_MONETARY 106de96322bSYuri Pankov atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_monetary.out" \ 107de96322bSYuri Pankov locale \ 108de96322bSYuri Pankov int_curr_symbol \ 109de96322bSYuri Pankov currency_symbol \ 110de96322bSYuri Pankov mon_decimal_point \ 111de96322bSYuri Pankov mon_thousands_sep \ 112de96322bSYuri Pankov mon_grouping \ 113de96322bSYuri Pankov positive_sign \ 114de96322bSYuri Pankov negative_sign \ 115de96322bSYuri Pankov int_frac_digits \ 116de96322bSYuri Pankov frac_digits \ 117de96322bSYuri Pankov p_cs_precedes \ 118de96322bSYuri Pankov p_sep_by_space \ 119de96322bSYuri Pankov n_cs_precedes \ 120de96322bSYuri Pankov n_sep_by_space \ 121de96322bSYuri Pankov p_sign_posn \ 122de96322bSYuri Pankov n_sign_posn \ 123de96322bSYuri Pankov int_p_cs_precedes \ 124de96322bSYuri Pankov int_n_cs_precedes \ 125de96322bSYuri Pankov int_p_sep_by_space \ 126de96322bSYuri Pankov int_n_sep_by_space \ 127de96322bSYuri Pankov int_p_sign_posn \ 128de96322bSYuri Pankov int_n_sign_posn 129de96322bSYuri Pankov 130de96322bSYuri Pankov # LC_NUMERIC 131de96322bSYuri Pankov atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_numeric.out" \ 132de96322bSYuri Pankov locale \ 133de96322bSYuri Pankov decimal_point \ 134de96322bSYuri Pankov thousands_sep \ 135de96322bSYuri Pankov grouping 136de96322bSYuri Pankov 137de96322bSYuri Pankov # LC_TIME 138de96322bSYuri Pankov atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_time.out" \ 139de96322bSYuri Pankov locale \ 140de96322bSYuri Pankov abday \ 141de96322bSYuri Pankov day \ 142de96322bSYuri Pankov abmon \ 143de96322bSYuri Pankov mon \ 144de96322bSYuri Pankov d_t_fmt \ 145de96322bSYuri Pankov d_fmt \ 146de96322bSYuri Pankov t_fmt \ 147de96322bSYuri Pankov am_pm \ 148de96322bSYuri Pankov t_fmt_ampm \ 149de96322bSYuri Pankov era \ 150de96322bSYuri Pankov era_d_fmt \ 151de96322bSYuri Pankov era_t_fmt \ 152de96322bSYuri Pankov era_d_t_fmt \ 153de96322bSYuri Pankov alt_digits 154de96322bSYuri Pankov 155de96322bSYuri Pankov # LC_MESSAGES 156de96322bSYuri Pankov atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_messages.out" \ 157de96322bSYuri Pankov locale \ 158de96322bSYuri Pankov yesexpr \ 159de96322bSYuri Pankov noexpr 160de96322bSYuri Pankov} 161de96322bSYuri Pankov 1626419bb52SYuri Pankovatf_test_case k_flag_unknown_kw 1636419bb52SYuri Pankovk_flag_unknown_kw_head() 1646419bb52SYuri Pankov{ 1656419bb52SYuri Pankov atf_set "descr" \ 1666419bb52SYuri Pankov "Verify 'locale -k' exit status is '1' for unknown keywords" 1676419bb52SYuri Pankov} 1686419bb52SYuri Pankovk_flag_unknown_kw_body() 1696419bb52SYuri Pankov{ 1706419bb52SYuri Pankov export LC_ALL="C" 1716419bb52SYuri Pankov 1726419bb52SYuri Pankov # Hopefully the keyword will stay nonexistent 1736419bb52SYuri Pankov atf_check -s exit:1 -o empty -e ignore locale -k nonexistent 1746419bb52SYuri Pankov} 1756419bb52SYuri Pankov 1766419bb52SYuri Pankov 17742249ef2SYuri Pankovatf_init_test_cases() 17842249ef2SYuri Pankov{ 17942249ef2SYuri Pankov atf_add_test_case k_flag_posix 180de96322bSYuri Pankov atf_add_test_case no_flags_posix 1816419bb52SYuri Pankov atf_add_test_case k_flag_unknown_kw 18242249ef2SYuri Pankov} 183