diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-05-30 14:17:22 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-05-30 14:17:22 -0600 |
commit | 6a6e3083d2d60cbd5bd581f432a0c56eff2bf29e (patch) | |
tree | b121fc58ee4d1d221cf25f09e57eca021397a396 /libmisc/tests/test_fmt.c | |
parent | 691d3fe7ff920e8113d174c2ce6c3126000a2f82 (diff) | |
parent | 87512b09de24bb76ad67cf4bb1ada8f12fcdea2c (diff) |
Merge branch 'lukeshu/misc'
Diffstat (limited to 'libmisc/tests/test_fmt.c')
-rw-r--r-- | libmisc/tests/test_fmt.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libmisc/tests/test_fmt.c b/libmisc/tests/test_fmt.c index a9157d6..64b3b8a 100644 --- a/libmisc/tests/test_fmt.c +++ b/libmisc/tests/test_fmt.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +#include <stdlib.h> /* for free() */ #include <string.h> /* for strcmp(), memcmp(), memset() */ #include <libmisc/fmt.h> @@ -230,5 +231,13 @@ int main() { test_assert(strcmp(str, "{0x68,0x65,0x6C,0x6C,0x6F,0x00}") == 0); memset(str, 0, sizeof(str)); + char *astr = fmt_asprint(""); + test_assert(astr != NULL && astr[0] == '\0'); + free(astr); + + astr = fmt_asprint("hello ", (base2, 9), (qstr, " world!\n")); + test_assert(strcmp(astr, "hello 1001\" world!\\n\"") == 0); + free(astr); + return 0; } |