mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
test-string-util: add a small test for xsprintf
This commit is contained in:
@@ -9,6 +9,19 @@
|
||||
#include "strv.h"
|
||||
#include "tests.h"
|
||||
|
||||
TEST(xsprintf) {
|
||||
char buf[5];
|
||||
|
||||
xsprintf(buf, "asdf");
|
||||
xsprintf(buf, "%4s", "a");
|
||||
xsprintf(buf, "%-4s", "a");
|
||||
xsprintf(buf, "%04d", 1);
|
||||
|
||||
ASSERT_SIGNAL(xsprintf(buf, "asdfe"), SIGABRT);
|
||||
ASSERT_SIGNAL(xsprintf(buf, "asdfefghdhdhdhdhd"), SIGABRT);
|
||||
ASSERT_SIGNAL(xsprintf(buf, "%5s", "a"), SIGABRT);
|
||||
}
|
||||
|
||||
TEST(string_erase) {
|
||||
char *x;
|
||||
x = strdupa_safe("");
|
||||
|
||||
Reference in New Issue
Block a user