Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/locale Change t_sprintf to an expected failur...
details: https://anonhg.NetBSD.org/src/rev/7a3e52d4f682
branches: trunk
changeset: 354212:7a3e52d4f682
user: perseant <perseant%NetBSD.org@localhost>
date: Wed Jun 07 22:59:42 2017 +0000
description:
Change t_sprintf to an expected failure, since we don't respect the empty
thousands separator of the C/POSIX locale (PR standards/52282).
diffstat:
tests/lib/libc/locale/t_sprintf.c | 44 +++++++++++++++++++++++++++++---------
1 files changed, 33 insertions(+), 11 deletions(-)
diffs (91 lines):
diff -r 5f4c5874e4ce -r 7a3e52d4f682 tests/lib/libc/locale/t_sprintf.c
--- a/tests/lib/libc/locale/t_sprintf.c Wed Jun 07 20:54:59 2017 +0000
+++ b/tests/lib/libc/locale/t_sprintf.c Wed Jun 07 22:59:42 2017 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: t_sprintf.c,v 1.1 2017/05/30 23:44:02 perseant Exp $ */
+/* $NetBSD: t_sprintf.c,v 1.2 2017/06/07 22:59:42 perseant Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
- * by Konrad Schroder
+ * by Konrad Schroder.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2017\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sprintf.c,v 1.1 2017/05/30 23:44:02 perseant Exp $");
+__RCSID("$NetBSD: t_sprintf.c,v 1.2 2017/06/07 22:59:42 perseant Exp $");
#include <locale.h>
#include <stdio.h>
@@ -53,14 +53,6 @@
const char *double_input;
} tests[] = {
{
- "C",
- -12345,
- "-12,345",
- "-12345",
- -12345.6789,
- "-12,345.678900",
- "-12345.678900",
- }, {
"en_US.UTF-8",
-12345,
"-12,345",
@@ -77,6 +69,30 @@
"-12\240345,678900",
"-12345,678900",
}, {
+ "it_IT.ISO8859-1",
+ -12345,
+ "-12.345",
+ "-12345",
+ -12345.6789,
+ "-12.345,678900",
+ "-12345,678900",
+ }, {
+ "POSIX",
+ /*
+ * POSIX-1.2008 specifies that the C and POSIX
+ * locales shall be identical (section 7.2) and
+ * that the POSIX locale shall have an empty
+ * thousands separator and "<period>" as its
+ * decimal point (section 7.3.4). *printf
+ * ought to honor these settings.
+ */
+ -12345,
+ "-12345",
+ "-12345",
+ -12345.6789,
+ "-12345.678900",
+ "-12345.678900",
+ }, {
NULL,
0,
NULL,
@@ -95,12 +111,18 @@
ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
printf("Trying locale %s...\n", t->locale);
ATF_REQUIRE(setlocale(LC_NUMERIC, t->locale) != NULL);
+ printf("Using locale: %s\n", setlocale(LC_ALL, NULL));
+
+ if (!strcmp("POSIX", t->locale))
+ atf_tc_expect_fail("%s", "PR standards/52282, printf doesn't respect empty thousands separator");
sprintf(buf, "%'f", t->double_value);
ATF_REQUIRE_STREQ(buf, t->double_result);
sprintf(buf, "%'d", t->int_value);
ATF_REQUIRE_STREQ(buf, t->int_result);
+
+ atf_tc_expect_pass();
}
static void
Home |
Main Index |
Thread Index |
Old Index