mg_file_write -> mg_file_printf

This commit is contained in:
cpq committed 2021-01-26 16:30:44 +00:00
1 parent 01691dafa0
commit 3c851bcfc3
7 files changed
+78 -28

No files matched your search

+6 -2
View File
@@ -1045,12 +1045,16 @@ static void test_dns(void) {
}
static void test_util(void) {
char buf[100], *s = mg_hexdump("abc", 3);
char buf[100], *s = mg_hexdump("abc", 3), *p;
struct mg_addr a;
ASSERT(s != NULL);
free(s);
memset(&a, 0, sizeof(a));
ASSERT(mg_file_write("data.txt", "%s", "hi") == 2);
ASSERT(mg_file_printf("data.txt", "%s", "hi") == true);
ASSERT((p = mg_file_read("data.txt")) != NULL);
ASSERT(strcmp(p, "hi") == 0);
free(p);
remove("data.txt");
ASSERT(mg_aton(mg_str("0"), &a) == false);
ASSERT(mg_aton(mg_str("0.0.0."), &a) == false);
ASSERT(mg_aton(mg_str("0.0.0.256"), &a) == false);