Improve parser errors slightly

This commit is contained in:
2022-11-15 15:18:37 -05:00
parent 583367ee9d
commit 785dbf06f6
4 changed files with 50 additions and 14 deletions

View File

@@ -4,6 +4,7 @@
#include "uclisp.h"
#include "internal.h"
#include "testing_helpers.h"
/* static struct ucl_parse_result *result; */
static struct ucl_object *response;
@@ -331,6 +332,20 @@ static void test_parse_nested(void) {
TEST_ASSERT_EQUAL_STRING("foo", response->cell.car->cell.car->cell.car->symbol);
}
static void test_parse_mismatched_open(void) {
response = ucl_parse("(");
TEST_ASSERT_NOT_NULL(response);
TEST_ASSERT_OBJ_ERROR(response);
}
static void test_parse_mismatched_closed(void) {
response = ucl_parse(")");
TEST_ASSERT_NOT_NULL(response);
TEST_ASSERT_OBJ_ERROR(response);
}
int main(void) {
UNITY_BEGIN();
@@ -357,5 +372,7 @@ int main(void) {
RUN_TEST(test_parse_2elem);
RUN_TEST(test_parse_2elem_str);
RUN_TEST(test_parse_nested);
RUN_TEST(test_parse_mismatched_open);
RUN_TEST(test_parse_mismatched_closed);
return UNITY_END();
}