yin parser CHANGE add support for units element
diff --git a/tests/src/test_parser_yin.c b/tests/src/test_parser_yin.c
index 962db69..0b7108c 100644
--- a/tests/src/test_parser_yin.c
+++ b/tests/src/test_parser_yin.c
@@ -672,11 +672,12 @@
"<value>error-msg</value>"
"</error-message>"
"<error-app-tag value=\"err-app-tag\"/>"
+ "<units name=\"radians\"></units>"
"</prefix>";
struct lysp_ext_instance *exts = NULL;
const char **if_features = NULL;
struct yin_arg_record *attrs = NULL;
- const char *value, *err_msg, *app_tag;
+ const char *value, *err_msg, *app_tag, *units;
struct lysp_ext *ext_def = NULL;
struct lysp_when *when_p = NULL;
uint8_t config = 0;
@@ -684,21 +685,23 @@
lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len);
yin_load_attributes(st->yin_ctx, &data, &attrs);
- struct yin_subelement subelems[8] = {{YANG_CONFIG, &config, 0},
+ struct yin_subelement subelems[9] = {{YANG_CONFIG, &config, 0},
{YANG_ERROR_APP_TAG, &app_tag, 0},
{YANG_ERROR_MESSAGE, &err_msg, 0},
{YANG_EXTENSION, &ext_def, 0},
{YANG_IF_FEATURE, &if_features, 0},
+ {YANG_UNITS, &units, 0},
{YANG_WHEN, &when_p, 0},
{YANG_CUSTOM, NULL, 0},
{YIN_TEXT, &value, 0}};
- ret = yin_parse_content(st->yin_ctx, subelems, 8, &data, YANG_PREFIX, NULL, &exts);
+ ret = yin_parse_content(st->yin_ctx, subelems, 9, &data, YANG_PREFIX, NULL, &exts);
assert_int_equal(ret, LY_SUCCESS);
assert_int_equal(st->yin_ctx->xml_ctx.status, LYXML_END);
/* check parsed values */
assert_string_equal(exts->name, "custom");
assert_string_equal(exts->argument, "totally amazing extension");
assert_string_equal(value, "wsefsdf");
+ assert_string_equal(units, "radians");
assert_string_equal(when_p->cond, "condition...");
assert_string_equal(when_p->dsc, "when_desc");
assert_string_equal(when_p->ref, "when_ref");
@@ -712,6 +715,7 @@
FREE_STRING(st->ctx, *if_features);
FREE_STRING(st->ctx, err_msg);
FREE_STRING(st->ctx, app_tag);
+ FREE_STRING(st->ctx, units);
LY_ARRAY_FREE(if_features);
LY_ARRAY_FREE(exts);
LY_ARRAY_FREE(ext_def);