/*
* Helper application to test internal library error reporting.
- * Copyright © 2023 Nick Bowler
+ * Copyright © 2023-2024 Nick Bowler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "errmsg.h"
#include "tap.h"
+/*
+ * Function called from output.c but not needed for error messaging.
+ */
const char *cdecl__token_name(unsigned token)
{
- assert(0);
+ tap_bail_out("stub cdecl__token_name called");
}
static char *fmt_char(int c, char *buf)
memset(work2, 'X', len - 1);
tap_diag("cdecl__err w/ %lu-byte string", (unsigned long)len);
- cdecl__err(1234, work1, "XX");
+ cdecl__err(work1, "XX");
memset(work1, 0, len);
err = cdecl_get_error();
- check_code(err, 1234);
+ check_code(err, CDECL_ENOPARSE);
errlen = strlen(err->str);
if (!tap_result(errlen == len-1, "returned string length")) {
abort();
sprintf(work, fmt, arg);
- cdecl__err(5432, fmt, arg);
+ cdecl__err(fmt, arg);
err = cdecl_get_error();
tap_diag("cdecl__err(\"%s\", \"%s\")", fmt, arg);
- check_code(err, 5432);
+ check_code(err, CDECL_ENOPARSE);
if (!tap_result(!strcmp(err->str, work), "returned string")) {
tap_diag("Failed, unexpected result");