Beispiel #1
0
static void
test_Cat(TestBatchRunner *runner) {
    String  *wanted = Str_newf("a%s", smiley);
    CharBuf *got    = S_get_cb("");

    CB_Cat(got, wanted);
    TEST_TRUE(runner, S_cb_equals(got, wanted), "Cat");
    DECREF(got);

    got = S_get_cb("a");
    CB_Cat_Char(got, 0x263A);
    TEST_TRUE(runner, S_cb_equals(got, wanted), "Cat_Char");
    DECREF(got);

    got = S_get_cb("a");
    CB_Cat_Utf8(got, smiley, smiley_len);
    TEST_TRUE(runner, S_cb_equals(got, wanted), "Cat_Utf8");
    DECREF(got);

    got = S_get_cb("a");
    CB_Cat_Trusted_Utf8(got, smiley, smiley_len);
    TEST_TRUE(runner, S_cb_equals(got, wanted), "Cat_Trusted_Utf8");
    DECREF(got);

    DECREF(wanted);
}
Beispiel #2
0
void
ErrMsg_set_with_win_error(const char *fmt, ...) {
    char *win_error = Err_win_error();

    CharBuf *buf = CB_new(0);

    va_list args;
    va_start(args, fmt);
    CB_VCatF(buf, fmt, args);
    va_end(args);

    CB_Cat_Trusted_Utf8(buf, ": ", 2);
    CB_Cat_Utf8(buf, win_error, strlen(win_error));

    Err_set_error(Err_new(CB_Yield_String(buf)));
    DECREF(buf);
    FREEMEM(win_error);
}