142249ef2SYuri Pankov# 242249ef2SYuri Pankov# SPDX-License-Identifier: BSD-2-Clause-FreeBSD 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# $FreeBSD$ 2842249ef2SYuri Pankov 2942249ef2SYuri Pankovatf_test_case k_flag_posix 3042249ef2SYuri Pankovk_flag_posix_head() 3142249ef2SYuri Pankov{ 32de96322bSYuri Pankov atf_set "descr" \ 33de96322bSYuri Pankov "Verify output of 'locale -k' for all POSIX specified keywords" 3442249ef2SYuri Pankov} 3542249ef2SYuri Pankovk_flag_posix_body() 3642249ef2SYuri Pankov{ 3742249ef2SYuri Pankov export LC_ALL="C" 3842249ef2SYuri Pankov 3942249ef2SYuri Pankov # LC_MONETARY 4042249ef2SYuri Pankov atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_monetary.out" \ 4142249ef2SYuri Pankov locale -k \ 4242249ef2SYuri Pankov int_curr_symbol \ 4342249ef2SYuri Pankov currency_symbol \ 4442249ef2SYuri Pankov mon_decimal_point \ 4542249ef2SYuri Pankov mon_thousands_sep \ 4642249ef2SYuri Pankov mon_grouping \ 4742249ef2SYuri Pankov positive_sign \ 4842249ef2SYuri Pankov negative_sign \ 4942249ef2SYuri Pankov int_frac_digits \ 5042249ef2SYuri Pankov frac_digits \ 5142249ef2SYuri Pankov p_cs_precedes \ 5242249ef2SYuri Pankov p_sep_by_space \ 5342249ef2SYuri Pankov n_cs_precedes \ 5442249ef2SYuri Pankov n_sep_by_space \ 5542249ef2SYuri Pankov p_sign_posn \ 5642249ef2SYuri Pankov n_sign_posn \ 5742249ef2SYuri Pankov int_p_cs_precedes \ 5842249ef2SYuri Pankov int_n_cs_precedes \ 5942249ef2SYuri Pankov int_p_sep_by_space \ 6042249ef2SYuri Pankov int_n_sep_by_space \ 6142249ef2SYuri Pankov int_p_sign_posn \ 6242249ef2SYuri Pankov int_n_sign_posn 6342249ef2SYuri Pankov 6442249ef2SYuri Pankov # LC_NUMERIC 6542249ef2SYuri Pankov atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_numeric.out" \ 6642249ef2SYuri Pankov locale -k \ 6742249ef2SYuri Pankov decimal_point \ 6842249ef2SYuri Pankov thousands_sep \ 6942249ef2SYuri Pankov grouping 7042249ef2SYuri Pankov 7142249ef2SYuri Pankov # LC_TIME 7242249ef2SYuri Pankov atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_time.out" \ 7342249ef2SYuri Pankov locale -k \ 7442249ef2SYuri Pankov abday \ 7542249ef2SYuri Pankov day \ 7642249ef2SYuri Pankov abmon \ 7742249ef2SYuri Pankov mon \ 7842249ef2SYuri Pankov d_t_fmt \ 7942249ef2SYuri Pankov d_fmt \ 8042249ef2SYuri Pankov t_fmt \ 8142249ef2SYuri Pankov am_pm \ 8242249ef2SYuri Pankov t_fmt_ampm \ 8342249ef2SYuri Pankov era \ 8442249ef2SYuri Pankov era_d_fmt \ 8542249ef2SYuri Pankov era_t_fmt \ 8642249ef2SYuri Pankov era_d_t_fmt \ 8742249ef2SYuri Pankov alt_digits 8842249ef2SYuri Pankov 8942249ef2SYuri Pankov # LC_MESSAGES 9042249ef2SYuri Pankov atf_check -o file:"$(atf_get_srcdir)/k_flag_posix_messages.out" \ 9142249ef2SYuri Pankov locale -k \ 9242249ef2SYuri Pankov yesexpr \ 9342249ef2SYuri Pankov noexpr 9442249ef2SYuri Pankov} 9542249ef2SYuri Pankov 96de96322bSYuri Pankovatf_test_case no_flags_posix 97de96322bSYuri Pankovno_flags_posix_head() 98de96322bSYuri Pankov{ 99de96322bSYuri Pankov atf_set "descr" \ 100de96322bSYuri Pankov "Verify output of 'locale' for all POSIX specified keywords" 101de96322bSYuri Pankov} 102de96322bSYuri Pankovno_flags_posix_body() 103de96322bSYuri Pankov{ 104de96322bSYuri Pankov export LC_ALL="C" 105de96322bSYuri Pankov 106de96322bSYuri Pankov # LC_MONETARY 107de96322bSYuri Pankov atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_monetary.out" \ 108de96322bSYuri Pankov locale \ 109de96322bSYuri Pankov int_curr_symbol \ 110de96322bSYuri Pankov currency_symbol \ 111de96322bSYuri Pankov mon_decimal_point \ 112de96322bSYuri Pankov mon_thousands_sep \ 113de96322bSYuri Pankov mon_grouping \ 114de96322bSYuri Pankov positive_sign \ 115de96322bSYuri Pankov negative_sign \ 116de96322bSYuri Pankov int_frac_digits \ 117de96322bSYuri Pankov frac_digits \ 118de96322bSYuri Pankov p_cs_precedes \ 119de96322bSYuri Pankov p_sep_by_space \ 120de96322bSYuri Pankov n_cs_precedes \ 121de96322bSYuri Pankov n_sep_by_space \ 122de96322bSYuri Pankov p_sign_posn \ 123de96322bSYuri Pankov n_sign_posn \ 124de96322bSYuri Pankov int_p_cs_precedes \ 125de96322bSYuri Pankov int_n_cs_precedes \ 126de96322bSYuri Pankov int_p_sep_by_space \ 127de96322bSYuri Pankov int_n_sep_by_space \ 128de96322bSYuri Pankov int_p_sign_posn \ 129de96322bSYuri Pankov int_n_sign_posn 130de96322bSYuri Pankov 131de96322bSYuri Pankov # LC_NUMERIC 132de96322bSYuri Pankov atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_numeric.out" \ 133de96322bSYuri Pankov locale \ 134de96322bSYuri Pankov decimal_point \ 135de96322bSYuri Pankov thousands_sep \ 136de96322bSYuri Pankov grouping 137de96322bSYuri Pankov 138de96322bSYuri Pankov # LC_TIME 139de96322bSYuri Pankov atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_time.out" \ 140de96322bSYuri Pankov locale \ 141de96322bSYuri Pankov abday \ 142de96322bSYuri Pankov day \ 143de96322bSYuri Pankov abmon \ 144de96322bSYuri Pankov mon \ 145de96322bSYuri Pankov d_t_fmt \ 146de96322bSYuri Pankov d_fmt \ 147de96322bSYuri Pankov t_fmt \ 148de96322bSYuri Pankov am_pm \ 149de96322bSYuri Pankov t_fmt_ampm \ 150de96322bSYuri Pankov era \ 151de96322bSYuri Pankov era_d_fmt \ 152de96322bSYuri Pankov era_t_fmt \ 153de96322bSYuri Pankov era_d_t_fmt \ 154de96322bSYuri Pankov alt_digits 155de96322bSYuri Pankov 156de96322bSYuri Pankov # LC_MESSAGES 157de96322bSYuri Pankov atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_messages.out" \ 158de96322bSYuri Pankov locale \ 159de96322bSYuri Pankov yesexpr \ 160de96322bSYuri Pankov noexpr 161de96322bSYuri Pankov} 162de96322bSYuri Pankov 163*6419bb52SYuri Pankovatf_test_case k_flag_unknown_kw 164*6419bb52SYuri Pankovk_flag_unknown_kw_head() 165*6419bb52SYuri Pankov{ 166*6419bb52SYuri Pankov atf_set "descr" \ 167*6419bb52SYuri Pankov "Verify 'locale -k' exit status is '1' for unknown keywords" 168*6419bb52SYuri Pankov} 169*6419bb52SYuri Pankovk_flag_unknown_kw_body() 170*6419bb52SYuri Pankov{ 171*6419bb52SYuri Pankov export LC_ALL="C" 172*6419bb52SYuri Pankov 173*6419bb52SYuri Pankov # Hopefully the keyword will stay nonexistent 174*6419bb52SYuri Pankov atf_check -s exit:1 -o empty -e ignore locale -k nonexistent 175*6419bb52SYuri Pankov} 176*6419bb52SYuri Pankov 177*6419bb52SYuri Pankov 17842249ef2SYuri Pankovatf_init_test_cases() 17942249ef2SYuri Pankov{ 18042249ef2SYuri Pankov atf_add_test_case k_flag_posix 181de96322bSYuri Pankov atf_add_test_case no_flags_posix 182*6419bb52SYuri Pankov atf_add_test_case k_flag_unknown_kw 18342249ef2SYuri Pankov} 184