add heim_error_t
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "heimbase.h"
|
||||
#include "heimbasepriv.h"
|
||||
@@ -138,6 +139,24 @@ test_string(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
test_error(void)
|
||||
{
|
||||
heim_error_t e;
|
||||
heim_string_t s;
|
||||
|
||||
e = heim_error_create(10, "foo: %s", "bar");
|
||||
heim_assert(heim_error_get_code(e) == 10, "error_code != 10");
|
||||
|
||||
s = heim_error_copy_string(e);
|
||||
heim_assert(strcmp(heim_string_get_utf8(s), "foo: bar") == 0, "msg wrong");
|
||||
|
||||
heim_release(s);
|
||||
heim_release(e);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -147,6 +166,7 @@ main(int argc, char **argv)
|
||||
res |= test_dict();
|
||||
res |= test_auto_release();
|
||||
res |= test_string();
|
||||
res |= test_error();
|
||||
|
||||
return res;
|
||||
return res ? 1 : 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user