From nobody Sat Nov 05 00:31:08 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N3z1m2y79z4hB9H; Sat, 5 Nov 2022 00:31:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N3z1m2VJZz3LgD; Sat, 5 Nov 2022 00:31:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667608268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9UIUOL8yDuI2SMuhmMq08bfH+1wrczwxQWm0aLoythk=; b=vR14y+kDPLk5sUFdFNCB/7EXm9zzSLeQm7wsBP2GURT/bL7tO737iFf8YgbhJiZF28hHw3 NkTLCuajCgTLyYsqp0qF234BMCZ057ePlUiG+qJ9TGFTjhc66FGVKDQz2JUYaPMNYid8/x u5BfO/rEKakIuBDYKOyxnY8/M6YLg6oMSSYC4/Oza8FuGrepsQ7+X3Mc5qpAdHQaEXwS3P L8Jrr+TTGfp2CTSWiiuCCgTP+bZkTjRVwv0R1dG+QqOOtrsmflHQa6SDNCs8kPLBxABu11 7choMZWuus6XyRX423lS9IDnd8FZQAKYfUZhC39ISgT4QVv6wnk8P+cfCT47xg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N3z1m1Z39zMX9; Sat, 5 Nov 2022 00:31:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2A50V8PX071105; Sat, 5 Nov 2022 00:31:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A50V8oa071104; Sat, 5 Nov 2022 00:31:08 GMT (envelope-from git) Date: Sat, 5 Nov 2022 00:31:08 GMT Message-Id: <202211050031.2A50V8oa071104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: dbfea0a6d894 - stable/13 - strfmon_test: Add a test for strfmon_l List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dbfea0a6d894ca11f6e383115f8e3afd045d8d4b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667608268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9UIUOL8yDuI2SMuhmMq08bfH+1wrczwxQWm0aLoythk=; b=lgri/vGcDH88oT9wT8V1vxF1Z8vLX8CsV2qy29wXd/qQQiMCZNxq/zbKp+S/HEqOqyRZh5 1/CeEN0ARMbQQlQBIEUvHkvM2p4SoalE8nuL5zX27yliHgIpv1ePanmroxHU5yi1b124u0 Nk53DVKx5K1H6ZvTF0wEFi9NIowVkdz0sBCZbggLQEXRtjWxgS3ksjnpjsmmxM8vjGPs0/ n83UoougRV0QxJ7QMgoxaeewAHN+XRiAJp8eFnmaSI7/EVEGWTg+9P5TBnnxGBDRlLAkuG JKDi1Qu9cBeGk8aZEIQ5aMIPkHlAmJiF56+8EGvBTjEcDUWZtzT+yoZ9a5u68Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667608268; a=rsa-sha256; cv=none; b=MJkBACc9KUE40LcBv6crTz3SEru3N0fvPuWSG1TrRl9Aod4j7mFLVoOGfz/GskchdT+YI5 1tCHebAeGUkdEwitMrGTAud4Pc+QtDY4ByVW85aawOh8a+GmyfjhAJMMyf6Qg+haN/pRbv ZdTZ8hs1jrUHxYTl9Uf1qfQ3TCWj6y/Uhe/Ry+wdQVFjMvoyQwHwPJiiDauH76foXtpeY5 8m6yjcw9aIDtkOcm3DMq5HzP414WgEMEZWW+GovRh0RAjmxgBHposTc9RwEsmZmYWQeMLH ANbTigwALiLABOFP6zTaSc7P1f1TXrqxYh1DnC02s/hfCrCJb7k4Jx92CMewTA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dbfea0a6d894ca11f6e383115f8e3afd045d8d4b commit dbfea0a6d894ca11f6e383115f8e3afd045d8d4b Author: Jose Luis Duran AuthorDate: 2022-10-28 02:53:43 +0000 Commit: Konstantin Belousov CommitDate: 2022-11-05 00:30:39 +0000 strfmon_test: Add a test for strfmon_l (cherry picked from commit 29972f06f95d6f5f550ac81367d5ebda8d6860a8) --- lib/libc/tests/stdlib/strfmon_test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/libc/tests/stdlib/strfmon_test.c b/lib/libc/tests/stdlib/strfmon_test.c index c2fa6250dc58..dcad17d3dbfd 100644 --- a/lib/libc/tests/stdlib/strfmon_test.c +++ b/lib/libc/tests/stdlib/strfmon_test.c @@ -211,6 +211,38 @@ ATF_TC_BODY(strfmon_international_currency_code, tc) } } +ATF_TC(strfmon_l); +ATF_TC_HEAD(strfmon_l, tc) +{ + atf_tc_set_md_var(tc, "descr", + "checks strfmon_l under different locales"); +} +ATF_TC_BODY(strfmon_l, tc) +{ + const struct { + const char *locale; + const char *expected; + } tests[] = { + { "C", "[ **1234.57 ] [ **1234.57 ]" }, + { "de_DE.UTF-8", "[ €**1234.57 ] [ EUR**1234.57 ]" }, /* XXX */ + { "en_GB.UTF-8", "[ £**1234.57 ] [ GBP**1234.57 ]" }, /* XXX */ + }; + locale_t loc; + size_t i; + char buf[100]; + + for (i = 0; i < nitems(tests); ++i) { + loc = newlocale(LC_MONETARY_MASK, tests[i].locale, NULL); + ATF_REQUIRE(loc != NULL); + + strfmon_l(buf, sizeof(buf) - 1, loc, "[%^=*#6n] [%=*#6i]", + 1234.567, 1234.567); + ATF_REQUIRE_STREQ(tests[i].expected, buf); + + freelocale(loc); + } +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, strfmon_locale_thousands); @@ -218,5 +250,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, strfmon_cs_precedes_0); ATF_TP_ADD_TC(tp, strfmon_cs_precedes_1); ATF_TP_ADD_TC(tp, strfmon_international_currency_code); + ATF_TP_ADD_TC(tp, strfmon_l); return (atf_no_error()); }