diff options
author | Jose Luis Duran <jlduran@gmail.com> | 2022-10-18 02:24:03 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2022-10-25 21:40:17 +0000 |
commit | 750fe3e6a4619e040c7b0951775698b61290102e (patch) | |
tree | c7f09b1dee55b1eb3f8d9bec810d657b4bde4089 /lib/libc/tests/stdlib/strfmon_test.c | |
parent | 947efadc3d6e778a824618d82f53f061bec69b77 (diff) | |
download | src-750fe3e6a4619e040c7b0951775698b61290102e.tar.gz src-750fe3e6a4619e040c7b0951775698b61290102e.zip |
strfmon: Fix an edge case when sep_by_space is 2
Fix an edge case by printing the required space when, the currency
symbol succeeds the value, a space separates the sign from the value and
the sign position precedes the quantity and the currency symbol.
In other words:
n_cs_precedes = 0
n_sep_by_space = 2
n_sign_posn = 1
From The Open Group's localeconv[1]:
> When {p,n,int_p,int_n}_sep_by_space is 2:
> If the currency symbol and sign string are adjacent, a space separates
> them; otherwise, a space separates the sign string from the value.
Format Before After
[%n] [-123.45¤] [- 123.45¤]
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html
Obtained from: Darwin
Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week
Diffstat (limited to 'lib/libc/tests/stdlib/strfmon_test.c')
-rw-r--r-- | lib/libc/tests/stdlib/strfmon_test.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/tests/stdlib/strfmon_test.c b/lib/libc/tests/stdlib/strfmon_test.c index d4d1f6a580d9..664d1811dc46 100644 --- a/lib/libc/tests/stdlib/strfmon_test.c +++ b/lib/libc/tests/stdlib/strfmon_test.c @@ -116,7 +116,7 @@ ATF_TC_BODY(strfmon_cs_precedes_0, tc) /* sep_by_space x sign_posn */ { "[(123.00$)] [-123.00$] [123.00$-] [123.00-$] [123.00$-]" }, { "[(123.00 $)] [-123.00 $] [123.00 $-] [123.00 -$] [123.00 $-]" }, - { "[(123.00$)] [-123.00$] [123.00$ -] [123.00- $] [123.00$ -]" }, /* XXX */ + { "[(123.00$)] [- 123.00$] [123.00$ -] [123.00- $] [123.00$ -]" }, }; size_t i, j; struct lconv *lc; |