mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
Add a test for positional parameters in g_snprintf(). Use g_printf()
* tests/string-test.c: Add a test for positional parameters in g_snprintf(). * glib-genmarshal.c, gobject-query.c: Use g_printf() instead of system printf. (#99319)
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "glib.h"
|
||||
#include "glib/gprintf.h"
|
||||
|
||||
int array[10000];
|
||||
gboolean failed = FALSE;
|
||||
@@ -226,6 +227,10 @@ main (int argc,
|
||||
g_assert (g_str_has_suffix("", "xyzzy") == FALSE);
|
||||
g_assert (g_str_has_suffix("", "") == TRUE);
|
||||
|
||||
tmp_string = (gchar *) g_malloc (10);
|
||||
g_snprintf (tmp_string, 10, "%2$s %1$s", "a", "b");
|
||||
g_assert (strcmp (tmp_string, "b a") == 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user