summaryrefslogtreecommitdiff
path: root/tests/libtcc_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libtcc_test.c')
-rw-r--r--tests/libtcc_test.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/libtcc_test.c b/tests/libtcc_test.c
index 480d314..d21c7fe 100644
--- a/tests/libtcc_test.c
+++ b/tests/libtcc_test.c
@@ -6,9 +6,15 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <assert.h>
#include "libtcc.h"
+void handle_error(void *opaque, const char *msg)
+{
+ fprintf(opaque, "%s\n", msg);
+}
+
/* this function is called by the generated code */
int add(int a, int b)
{
@@ -53,6 +59,14 @@ int main(int argc, char **argv)
exit(1);
}
+ assert(tcc_get_error_func(s) == NULL);
+ assert(tcc_get_error_opaque(s) == NULL);
+
+ tcc_set_error_func(s, stderr, handle_error);
+
+ assert(tcc_get_error_func(s) == handle_error);
+ assert(tcc_get_error_opaque(s) == stderr);
+
/* if tcclib.h and libtcc1.a are not installed, where can we find them */
for (i = 1; i < argc; ++i) {
char *a = argv[i];