summaryrefslogtreecommitdiff
path: root/tests/test_asprintf.c
blob: 67723e8f2d44a8bdf381616fda807e723eafb794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#define _GNU_SOURCE
#include "common.h"

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
    char* buf;
    asprintf(&buf, "total: %d+%d=%d", 1, 2, 3);
    puts(buf);
    free(buf);

#if 0
#ifndef __clang__
    asprintf(&buf, "total: %", 1);
    assert(buf == NULL);
#endif
#endif

    return 0;
}