]> Savannah Git Hosting - gnulib.git/commitdiff
unistdio/*printf tests: Update expected test results regarding %n.
authorBruno Haible <bruno@clisp.org>
Fri, 23 Feb 2024 12:07:48 +0000 (13:07 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 23 Feb 2024 12:07:48 +0000 (13:07 +0100)
* tests/unistdio/test-u8-printf1.h (test_xfunction): If
NEED_PRINTF_WITH_N_DIRECTIVE is not defined, expect a NULL result in the
%n test.
* tests/unistdio/test-u16-printf1.h (test_xfunction): Likewise.
* tests/unistdio/test-u32-printf1.h (test_xfunction): Likewise.
* tests/unistdio/test-ulc-printf1.h (test_xfunction): Likewise.

ChangeLog
tests/unistdio/test-u16-printf1.h
tests/unistdio/test-u32-printf1.h
tests/unistdio/test-u8-printf1.h
tests/unistdio/test-ulc-printf1.h

index 2bd61f3052d021104425b126d3cdac6efcc0e6ac..1049bc0a91648fe477e949d9151b207987b75ed3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-02-23  Bruno Haible  <bruno@clisp.org>
+
+       unistdio/*printf tests: Update expected test results regarding %n.
+       * tests/unistdio/test-u8-printf1.h (test_xfunction): If
+       NEED_PRINTF_WITH_N_DIRECTIVE is not defined, expect a NULL result in the
+       %n test.
+       * tests/unistdio/test-u16-printf1.h (test_xfunction): Likewise.
+       * tests/unistdio/test-u32-printf1.h (test_xfunction): Likewise.
+       * tests/unistdio/test-ulc-printf1.h (test_xfunction): Likewise.
+
 2024-02-22  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Follow gnulib-tool changes, part 26.
index 72655e7202f0107aaa12b8deb833f205ee068090..e501c9e462ee91c6f889eaf5a3f506b6f8a0b12e 100644 (file)
@@ -1032,12 +1032,16 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
     int count = -1;
     uint16_t *result =
       my_xasprintf ("%d %n", 123, &count, 33, 44, 55);
+#if NEED_PRINTF_WITH_N_DIRECTIVE
     static const uint16_t expected[] =
       { '1', '2', '3', ' ', 0 };
     ASSERT (result != NULL);
     ASSERT (u16_strcmp (result, expected) == 0);
     ASSERT (count == 4);
     free (result);
+#else
+    ASSERT (result == NULL);
+#endif
   }
 
   /* Test the support of the POSIX/XSI format strings with positions.  */
index 0cebba28196489e8396fe9130488bb2f870bbc1b..ae0edc6a63aec4b25a78ae28c977019e4f6ca325 100644 (file)
@@ -1032,12 +1032,16 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
     int count = -1;
     uint32_t *result =
       my_xasprintf ("%d %n", 123, &count, 33, 44, 55);
+#if NEED_PRINTF_WITH_N_DIRECTIVE
     static const uint32_t expected[] =
       { '1', '2', '3', ' ', 0 };
     ASSERT (result != NULL);
     ASSERT (u32_strcmp (result, expected) == 0);
     ASSERT (count == 4);
     free (result);
+#else
+    ASSERT (result == NULL);
+#endif
   }
 
   /* Test the support of the POSIX/XSI format strings with positions.  */
index 2b762737f172e5f9c39497f37bb2d3392c12ba8c..3e8999b638c393db7b55200db4aa716dd2a84ed4 100644 (file)
@@ -786,11 +786,15 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
     int count = -1;
     uint8_t *result =
       my_xasprintf ("%d %n", 123, &count, 33, 44, 55);
+#if NEED_PRINTF_WITH_N_DIRECTIVE
     static const uint8_t expected[] = "123 ";
     ASSERT (result != NULL);
     ASSERT (u8_strcmp (result, expected) == 0);
     ASSERT (count == 4);
     free (result);
+#else
+    ASSERT (result == NULL);
+#endif
   }
 
   /* Test the support of the POSIX/XSI format strings with positions.  */
index 7617185a088fc0cabb800e5f761cc5553d659ada..49089c1bfd328075a096373657b264969a199618 100644 (file)
@@ -670,10 +670,14 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
     int count = -1;
     char *result =
       my_xasprintf ("%d %n", 123, &count, 33, 44, 55);
+#if NEED_PRINTF_WITH_N_DIRECTIVE
     ASSERT (result != NULL);
     ASSERT (strcmp (result, "123 ") == 0);
     ASSERT (count == 4);
     free (result);
+#else
+    ASSERT (result == NULL);
+#endif
   }
 
   /* Test the support of the POSIX/XSI format strings with positions.  */