diff options
author | Bruno Haible <bruno@clisp.org> | 2008-02-07 02:08:13 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2008-02-07 02:08:13 +0100 |
commit | 6cad9c91215eac0f90bbb1f9473ea0f5fce3b085 (patch) | |
tree | eb9e9529c870497dc2fa4638740a1f6a09b7c6c3 /tests/test-vasprintf-posix.c | |
parent | e2cc522f19bb9144ad1ee284152bd2b0a1c43427 (diff) | |
download | gnulib-6cad9c91215eac0f90bbb1f9473ea0f5fce3b085.tar.gz |
Fix *printf behaviour regarding the left-adjust flag on HP-UX 10.20.
Diffstat (limited to 'tests/test-vasprintf-posix.c')
-rw-r--r-- | tests/test-vasprintf-posix.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/test-vasprintf-posix.c b/tests/test-vasprintf-posix.c index 37a6db6fbe..68da28c817 100644 --- a/tests/test-vasprintf-posix.c +++ b/tests/test-vasprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible vasprintf() and asprintf() functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3234,6 +3234,38 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) free (result); } + /* Test the support of the left-adjust flag. */ + + { + char *result; + int retval = + my_asprintf (&result, "a%*sc", -3, "b"); + ASSERT (result != NULL); + ASSERT (strcmp (result, "ab c") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "a%-*sc", 3, "b"); + ASSERT (result != NULL); + ASSERT (strcmp (result, "ab c") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "a%-*sc", -3, "b"); + ASSERT (result != NULL); + ASSERT (strcmp (result, "ab c") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + /* Test the support of large precision. */ { |