Module Name:    src
Committed By:   jruoho
Date:           Sun Mar 18 08:13:57 UTC 2012

Modified Files:
        src/tests/lib/libc/stdio: t_printf.c

Log Message:
Verify that PR lib/22019 is no longer an issue.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/stdio/t_printf.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/stdio/t_printf.c
diff -u src/tests/lib/libc/stdio/t_printf.c:1.6 src/tests/lib/libc/stdio/t_printf.c:1.7
--- src/tests/lib/libc/stdio/t_printf.c:1.6	Sun Mar 18 07:00:51 2012
+++ src/tests/lib/libc/stdio/t_printf.c	Sun Mar 18 08:13:57 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: t_printf.c,v 1.6 2012/03/18 07:00:51 jruoho Exp $ */
+/* $NetBSD: t_printf.c,v 1.7 2012/03/18 08:13:57 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -36,11 +36,32 @@
 #include <time.h>
 #include <stdlib.h>
 
+ATF_TC(snprintf_c99);
+ATF_TC_HEAD(snprintf_c99, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	    "Test printf(3) C99 conformance (PR lib/22019)");
+}
+
+ATF_TC_BODY(snprintf_c99, tc)
+{
+	char s[4];
+
+	(void)memset(s, '\0', sizeof(s));
+	(void)snprintf(s, sizeof(s), "%#.o", 0);
+	(void)printf("printf = %#.o\n", 0);
+	(void)fprintf(stderr, "snprintf = %s", s);
+
+	ATF_REQUIRE(strlen(s) == 1);
+	ATF_REQUIRE(s[0] == '0');
+}
+
 ATF_TC(snprintf_dotzero);
 ATF_TC_HEAD(snprintf_dotzero, tc)
 {
 
-	atf_tc_set_md_var(tc, "descr", \
+	atf_tc_set_md_var(tc, "descr",
 	    "PR lib/32951: %%.0f formats (0.0,0.5] to \"0.\"");
 }
 
@@ -161,6 +182,7 @@ ATF_TC_BODY(sprintf_zeropad, tc)
 ATF_TP_ADD_TCS(tp)
 {
 
+	ATF_TP_ADD_TC(tp, snprintf_c99);
 	ATF_TP_ADD_TC(tp, snprintf_dotzero);
 	ATF_TP_ADD_TC(tp, snprintf_posarg);
 	ATF_TP_ADD_TC(tp, snprintf_posarg_width);

Reply via email to