Module Name: src
Committed By: perseant
Date: Wed Jun 7 22:59:42 UTC 2017
Modified Files:
src/tests/lib/libc/locale: t_sprintf.c
Log Message:
Change t_sprintf to an expected failure, since we don't respect the empty
thousands separator of the C/POSIX locale (PR standards/52282).
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/locale/t_sprintf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libc/locale/t_sprintf.c
diff -u src/tests/lib/libc/locale/t_sprintf.c:1.1 src/tests/lib/libc/locale/t_sprintf.c:1.2
--- src/tests/lib/libc/locale/t_sprintf.c:1.1 Tue May 30 23:44:02 2017
+++ src/tests/lib/libc/locale/t_sprintf.c Wed Jun 7 22:59:42 2017
@@ -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 @@ static struct test {
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 @@ static struct test {
"-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 @@ h_sprintf(const struct test *t)
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