diff --git a/src/common.c b/src/common.c
index e34d42e..e658031 100644
--- a/src/common.c
+++ b/src/common.c
@@ -25,6 +25,7 @@
 
 #include "extensions.h"
 #include "tree_schema.h"
+#include "tree_schema_internal.h"
 
 const char *const ly_stmt_list[] = {
     [YANG_ACTION] = "action",
@@ -364,3 +365,156 @@
     *ret = u;
     return LY_SUCCESS;
 }
+
+/**
+ * @brief Parse an identifier.
+ *
+ * ;; An identifier MUST NOT start with (('X'|'x') ('M'|'m') ('L'|'l'))
+ * identifier          = (ALPHA / "_")
+ *                       *(ALPHA / DIGIT / "_" / "-" / ".")
+ *
+ * @param[in,out] id Identifier to parse. When returned, it points to the first character which is not part of the identifier.
+ * @return LY_ERR value: LY_SUCCESS or LY_EINVAL in case of invalid starting character.
+ */
+static LY_ERR
+lys_parse_id(const char **id)
+{
+    assert(id && *id);
+
+    if (!is_yangidentstartchar(**id)) {
+        return LY_EINVAL;
+    }
+    ++(*id);
+
+    while (is_yangidentchar(**id)) {
+        ++(*id);
+    }
+    return LY_SUCCESS;
+}
+
+LY_ERR
+ly_parse_nodeid(const char **id, const char **prefix, size_t *prefix_len, const char **name, size_t *name_len)
+{
+    assert(id && *id);
+    assert(prefix && prefix_len);
+    assert(name && name_len);
+
+    *prefix = *id;
+    *prefix_len = 0;
+    *name = NULL;
+    *name_len = 0;
+
+    LY_CHECK_RET(lys_parse_id(id));
+    if (**id == ':') {
+        /* there is prefix */
+        *prefix_len = *id - *prefix;
+        ++(*id);
+        *name = *id;
+
+        LY_CHECK_RET(lys_parse_id(id));
+        *name_len = *id - *name;
+    } else {
+        /* there is no prefix, so what we have as prefix now is actually the name */
+        *name = *prefix;
+        *name_len = *id - *name;
+        *prefix = NULL;
+    }
+
+    return LY_SUCCESS;
+}
+
+LY_ERR
+ly_parse_instance_predicate(const char **pred, size_t limit,
+                             const char **prefix, size_t *prefix_len, const char **id, size_t *id_len, const char **value, size_t *value_len,
+                             const char **errmsg)
+{
+    LY_ERR ret = LY_EVALID;
+    const char *in = *pred;
+    size_t offset = 1;
+    int expr = 0;
+    char quot;
+
+    assert(in[0] == '\[');
+
+    *prefix = *id = *value = NULL;
+    *prefix_len = *id_len = *value_len = 0;
+
+    /* leading *WSP */
+    for (; isspace(in[offset]); offset++);
+
+    if (isdigit(in[offset])) {
+        /* pos: "[" *WSP positive-integer-value *WSP "]" */
+        if (in[offset] == '0') {
+            /* zero */
+            *errmsg = "The position predicate cannot be zero.";
+            goto error;
+        }
+
+        /* positive-integer-value */
+        *id = &in[offset++];
+        for (; isdigit(in[offset]); offset++);
+        *id_len = &in[offset] - *id;
+
+    } else if (in[offset] == '.') {
+        /* leaf-list-predicate: "[" *WSP "." *WSP "=" *WSP quoted-string *WSP "]" */
+        *id = &in[offset];
+        *id_len = 1;
+        offset++;
+        expr = 1;
+
+    } else {
+        /* key-predicate: "[" *WSP node-identifier *WSP "=" *WSP quoted-string *WSP "]" */
+        in = &in[offset];
+        if (ly_parse_nodeid(&in, prefix, prefix_len, id, id_len)) {
+            *errmsg = "Invalid node-identifier.";
+            goto error;
+        }
+        offset = in - *pred;
+        in = *pred;
+        expr = 1;
+    }
+
+    if (expr) {
+        /*  *WSP "=" *WSP quoted-string *WSP "]" */
+        for (; isspace(in[offset]); offset++);
+
+        if (in[offset] != '=') {
+            *errmsg = "Unexpected character instead of \'=\'.";
+            goto error;
+        }
+        offset++;
+        for (; isspace(in[offset]); offset++);
+
+        /* quoted-string */
+        quot = in[offset++];
+        if (quot != '\'' && quot != '\"') {
+            *errmsg = "String value is not quoted.";
+            goto error;
+        }
+        *value = &in[offset];
+        for (;offset < limit && in[offset] != quot; offset++);
+        *value_len = &in[offset] - *value;
+    }
+
+    /* *WSP "]" */
+    for(; isspace(in[offset]); offset++);
+    if (in[offset] != ']') {
+        *errmsg = "Predicate is not terminated by \']\' character.";
+        goto error;
+    }
+
+    if (offset < limit) {
+        return LY_SUCCESS;
+    }
+
+    /* we read after the limit */
+    *errmsg = "Predicate is incomplete.";
+    *prefix = *id = *value = NULL;
+    *prefix_len = *id_len = *value_len = 0;
+    offset = limit;
+    ret = LY_EINVAL;
+
+error:
+    *pred = &in[offset];
+    return ret;
+}
diff --git a/src/common.h b/src/common.h
index 225414e..c8c4b60 100644
--- a/src/common.h
+++ b/src/common.h
@@ -383,6 +383,42 @@
 LY_ERR ly_parse_uint(const char *val_str, size_t val_len, uint64_t max, int base, uint64_t *ret);
 
 /**
+ * @brief Parse a node-identifier.
+ *
+ * node-identifier     = [prefix ":"] identifier
+ *
+ * @param[in, out] id Identifier to parse. When returned, it points to the first character which is not part of the identifier.
+ * @param[out] prefix Node's prefix, NULL if there is not any.
+ * @param[out] prefix_len Length of the node's prefix, 0 if there is not any.
+ * @param[out] name Node's name.
+ * @param[out] nam_len Length of the node's name.
+ * @return LY_ERR value: LY_SUCCESS or LY_EINVAL in case of invalid character in the id.
+ */
+LY_ERR ly_parse_nodeid(const char **id, const char **prefix, size_t *prefix_len, const char **name, size_t *name_len);
+
+/**
+ * @brief parse instance-identifier's predicate, supports key-predicate, leaf-list-predicate and pos rules from YANG ABNF Grammar.
+ *
+ * @param[in, out] pred Predicate string (including the leading '[') to parse. The string is updated according to what was parsed
+ * (even for error case, so it can be used to determine which substring caused failure).
+ * @param[in] limit Limiting length of the @p pred. Function expects NULL terminated string which is not overread.
+ * The limit value is not checked with each character, so it can be overread and the failure is detected later.
+ * @param[out] prefix Start of the node-identifier's prefix if any, NULL in case of pos or leaf-list-predicate rules.
+ * @param[out] prefix_len Length of the parsed @p prefix.
+ * @param[out] id Start of the node-identifier's identifier string, NULL in case of pos rule, "." in case of leaf-list-predicate rule.
+ * @param[out] id_len Length of the parsed @p id.
+ * @param[out] value Start of the quoted-string (without quotation marks), NULL in case of pos rule.
+ * @param[out] value_len Length of the parsed @p value.
+ * @param[out] errmsg Error message string in case of error.
+ * @return LY_SUCCESS in case a complete predicate was parsed.
+ * @return LY_EVALID in case of invalid predicate form.
+ * @return LY_EINVAL in case of reaching @p limit when parsing @p pred.
+ */
+LY_ERR ly_parse_instance_predicate(const char **pred, size_t limit,
+                                   const char **prefix, size_t *prefix_len, const char **id, size_t *id_len,
+                                   const char **value, size_t *value_len, const char **errmsg);
+
+/**
  * @brief mmap(2) wrapper to map input files into memory to unify parsing.
  *
  * The address space is allocate only for reading.
diff --git a/src/plugins_types.c b/src/plugins_types.c
index 822c05e..f5bdd78 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -1244,7 +1244,7 @@
         if (token[0] == '/') {
             /* node identifier */
             token++;
-            if (lys_parse_nodeid(&token, &prefix, &prefix_len, &id, &id_len)) {
+            if (ly_parse_nodeid(&token, &prefix, &prefix_len, &id, &id_len)) {
                 asprintf(&errmsg, "Invalid instance-identifier \"%.*s\" value at character %lu.",
                          (int)value_len, value, token - value + 1);
                 goto error;
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index c4fa318..68c219f 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -1972,7 +1972,7 @@
         while (isspace(**predicate)) {
             ++(*predicate);
         }
-        LY_CHECK_GOTO(lys_parse_nodeid(predicate, &src_prefix, &src_prefix_len, &src, &src_len), cleanup);
+        LY_CHECK_GOTO(ly_parse_nodeid(predicate, &src_prefix, &src_prefix_len, &src, &src_len), cleanup);
         while (isspace(**predicate)) {
             ++(*predicate);
         }
@@ -2111,7 +2111,7 @@
         }
 
         while(path_key_expr != pke_end) {
-            if (lys_parse_nodeid(&path_key_expr, &dst_prefix, &dst_prefix_len, &dst, &dst_len)) {
+            if (ly_parse_nodeid(&path_key_expr, &dst_prefix, &dst_prefix_len, &dst, &dst_len)) {
                 LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SYNTAX_YANG,
                        "Invalid node identifier in leafref path predicate - character %d (of %.*s).",
                        path_key_expr - start + 1, *predicate - start, start);
@@ -2217,7 +2217,7 @@
     ++(*path);
 
     /* node-identifier ([prefix:]name) */
-    LY_CHECK_RET(lys_parse_nodeid(path, prefix, prefix_len, name, name_len));
+    LY_CHECK_RET(ly_parse_nodeid(path, prefix, prefix_len, name, name_len));
 
     if ((**path == '/' && (*path)[1]) || !**path) {
         /* path continues by another token or this is the last token */
@@ -4381,7 +4381,7 @@
     /* search for the grouping definition */
     found = 0;
     id = uses_p->name;
-    LY_CHECK_RET(lys_parse_nodeid(&id, &prefix, &prefix_len, &name, &name_len), LY_EVALID);
+    LY_CHECK_RET(ly_parse_nodeid(&id, &prefix, &prefix_len, &name, &name_len), LY_EVALID);
     if (prefix) {
         mod = lys_module_find_prefix(ctx->mod_def, prefix, prefix_len);
         if (!mod) {
@@ -5580,7 +5580,7 @@
                         DEV_CHECK_CARDINALITY(d_del->dflts, 1, "default");
                         DEV_CHECK_PRESENCE(struct lysc_node_choice*, 0, dflt, "deleting", "default", d_del->dflts[0]);
                         nodeid = d_del->dflts[0];
-                        LY_CHECK_GOTO(lys_parse_nodeid(&nodeid, &prefix, &prefix_len, &name, &name_len), cleanup);
+                        LY_CHECK_GOTO(ly_parse_nodeid(&nodeid, &prefix, &prefix_len, &name, &name_len), cleanup);
                         if (prefix) {
                             /* use module prefixes from the deviation module to match the module of the default case */
                             if (!(mod = lys_module_find_prefix(ctx->mod, prefix, prefix_len))) {
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 297bf35..a2a20b3 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -34,159 +34,6 @@
 #include "tree_schema.h"
 #include "tree_schema_internal.h"
 
-/**
- * @brief Parse an identifier.
- *
- * ;; An identifier MUST NOT start with (('X'|'x') ('M'|'m') ('L'|'l'))
- * identifier          = (ALPHA / "_")
- *                       *(ALPHA / DIGIT / "_" / "-" / ".")
- *
- * @param[in,out] id Identifier to parse. When returned, it points to the first character which is not part of the identifier.
- * @return LY_ERR value: LY_SUCCESS or LY_EINVAL in case of invalid starting character.
- */
-static LY_ERR
-lys_parse_id(const char **id)
-{
-    assert(id && *id);
-
-    if (!is_yangidentstartchar(**id)) {
-        return LY_EINVAL;
-    }
-    ++(*id);
-
-    while (is_yangidentchar(**id)) {
-        ++(*id);
-    }
-    return LY_SUCCESS;
-}
-
-LY_ERR
-lys_parse_nodeid(const char **id, const char **prefix, size_t *prefix_len, const char **name, size_t *name_len)
-{
-    assert(id && *id);
-    assert(prefix && prefix_len);
-    assert(name && name_len);
-
-    *prefix = *id;
-    *prefix_len = 0;
-    *name = NULL;
-    *name_len = 0;
-
-    LY_CHECK_RET(lys_parse_id(id));
-    if (**id == ':') {
-        /* there is prefix */
-        *prefix_len = *id - *prefix;
-        ++(*id);
-        *name = *id;
-
-        LY_CHECK_RET(lys_parse_id(id));
-        *name_len = *id - *name;
-    } else {
-        /* there is no prefix, so what we have as prefix now is actually the name */
-        *name = *prefix;
-        *name_len = *id - *name;
-        *prefix = NULL;
-    }
-
-    return LY_SUCCESS;
-}
-
-LY_ERR
-lys_parse_instance_predicate(const char **pred, size_t limit,
-                             const char **prefix, size_t *prefix_len, const char **id, size_t *id_len, const char **value, size_t *value_len,
-                             const char **errmsg)
-{
-    LY_ERR ret = LY_EVALID;
-    const char *in = *pred;
-    size_t offset = 1;
-    int expr = 0;
-    char quot;
-
-    assert(in[0] == '\[');
-
-    *prefix = *id = *value = NULL;
-    *prefix_len = *id_len = *value_len = 0;
-
-    /* leading *WSP */
-    for (; isspace(in[offset]); offset++);
-
-    if (isdigit(in[offset])) {
-        /* pos: "[" *WSP positive-integer-value *WSP "]" */
-        if (in[offset] == '0') {
-            /* zero */
-            *errmsg = "The position predicate cannot be zero.";
-            goto error;
-        }
-
-        /* positive-integer-value */
-        *id = &in[offset++];
-        for (; isdigit(in[offset]); offset++);
-        *id_len = &in[offset] - *id;
-
-    } else if (in[offset] == '.') {
-        /* leaf-list-predicate: "[" *WSP "." *WSP "=" *WSP quoted-string *WSP "]" */
-        *id = &in[offset];
-        *id_len = 1;
-        offset++;
-        expr = 1;
-
-    } else {
-        /* key-predicate: "[" *WSP node-identifier *WSP "=" *WSP quoted-string *WSP "]" */
-        in = &in[offset];
-        if (lys_parse_nodeid(&in, prefix, prefix_len, id, id_len)) {
-            *errmsg = "Invalid node-identifier.";
-            goto error;
-        }
-        offset = in - *pred;
-        in = *pred;
-        expr = 1;
-    }
-
-    if (expr) {
-        /*  *WSP "=" *WSP quoted-string *WSP "]" */
-        for (; isspace(in[offset]); offset++);
-
-        if (in[offset] != '=') {
-            *errmsg = "Unexpected character instead of \'=\'.";
-            goto error;
-        }
-        offset++;
-        for (; isspace(in[offset]); offset++);
-
-        /* quoted-string */
-        quot = in[offset++];
-        if (quot != '\'' && quot != '\"') {
-            *errmsg = "String value is not quoted.";
-            goto error;
-        }
-        *value = &in[offset];
-        for (;offset < limit && in[offset] != quot; offset++);
-        *value_len = &in[offset] - *value;
-    }
-
-    /* *WSP "]" */
-    for(; isspace(in[offset]); offset++);
-    if (in[offset] != ']') {
-        *errmsg = "Predicate is not terminated by \']\' character.";
-        goto error;
-    }
-
-    if (offset < limit) {
-        return LY_SUCCESS;
-    }
-
-    /* we read after the limit */
-    *errmsg = "Predicate is incomplete.";
-    *prefix = *id = *value = NULL;
-    *prefix_len = *id_len = *value_len = 0;
-    offset = limit;
-    ret = LY_EINVAL;
-
-error:
-    *pred = &in[offset];
-    return ret;
-}
-
 LY_ERR
 lys_resolve_schema_nodeid(struct lysc_ctx *ctx, const char *nodeid, size_t nodeid_len, const struct lysc_node *context_node,
                           const struct lys_module *context_module, int nodetype, int implement,
@@ -231,7 +78,7 @@
         ++id;
     }
 
-    while (*id && (ret = lys_parse_nodeid(&id, &prefix, &prefix_len, &name, &name_len)) == LY_SUCCESS) {
+    while (*id && (ret = ly_parse_nodeid(&id, &prefix, &prefix_len, &name, &name_len)) == LY_SUCCESS) {
         if (prefix) {
             mod = lys_module_find_prefix(context_module, prefix, prefix_len);
             if (!mod) {
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index b01a496..9ae064b 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -301,20 +301,6 @@
                          uint16_t flags2, void *mod2, const char *name2);
 
 /**
- * @brief Parse a node-identifier.
- *
- * node-identifier     = [prefix ":"] identifier
- *
- * @param[in, out] id Identifier to parse. When returned, it points to the first character which is not part of the identifier.
- * @param[out] prefix Node's prefix, NULL if there is not any.
- * @param[out] prefix_len Length of the node's prefix, 0 if there is not any.
- * @param[out] name Node's name.
- * @param[out] nam_len Length of the node's name.
- * @return LY_ERR value: LY_SUCCESS or LY_EINVAL in case of invalid character in the id.
- */
-LY_ERR lys_parse_nodeid(const char **id, const char **prefix, size_t *prefix_len, const char **name, size_t *name_len);
-
-/**
  * @brief Find the node according to the given descendant/absolute schema nodeid.
  * Used in unique, refine and augment statements.
  *
@@ -339,28 +325,6 @@
                                  const struct lysc_node **target, uint16_t *result_flag);
 
 /**
- * @brief parse instance-identifier's predicate, supports key-predicate, leaf-list-predicate and pos rules from YANG ABNF Grammar.
- *
- * @param[in, out] pred Predicate string (including the leading '[') to parse. The string is updated according to what was parsed
- * (even for error case, so it can be used to determine which substring caused failure).
- * @param[in] limit Limiting length of the @p pred. Function expects NULL terminated string which is not overread.
- * The limit value is not checked with each character, so it can be overread and the failure is detected later.
- * @param[out] prefix Start of the node-identifier's prefix if any, NULL in case of pos or leaf-list-predicate rules.
- * @param[out] prefix_len Length of the parsed @p prefix.
- * @param[out] id Start of the node-identifier's identifier string, NULL in case of pos rule, "." in case of leaf-list-predicate rule.
- * @param[out] id_len Length of the parsed @p id.
- * @param[out] value Start of the quoted-string (without quotation marks), NULL in case of pos rule.
- * @param[out] value_len Length of the parsed @p value.
- * @param[out] errmsg Error message string in case of error.
- * @return LY_SUCCESS in case a complete predicate was parsed.
- * @return LY_EVALID in case of invalid predicate form.
- * @return LY_EINVAL in case of reaching @p limit when parsing @p pred.
- */
-LY_ERR lys_parse_instance_predicate(const char **pred, size_t limit,
-                                    const char **prefix, size_t *prefix_len, const char **id, size_t *id_len,
-                                    const char **value, size_t *value_len, const char **errmsg);
-
-/**
  * @brief Find the module referenced by prefix in the provided mod.
  *
  * Reverse function to lys_prefix_find_module().
diff --git a/tests/src/test_common.c b/tests/src/test_common.c
index b79f3ec..046950f 100644
--- a/tests/src/test_common.c
+++ b/tests/src/test_common.c
@@ -21,15 +21,28 @@
 
 #define BUFSIZE 1024
 char logbuf[BUFSIZE] = {0};
+int store = -1; /* negative for infinite logging, positive for limited logging */
 
+/* set to 0 to printing error messages to stderr instead of checking them in code */
+#define ENABLE_LOGGER_CHECKING 1
+
+#if ENABLE_LOGGER_CHECKING
 static void
 logger(LY_LOG_LEVEL level, const char *msg, const char *path)
 {
     (void) level; /* unused */
-    (void) path; /* unused */
-
-    strncpy(logbuf, msg, BUFSIZE - 1);
+    if (store) {
+        if (path && path[0]) {
+            snprintf(logbuf, BUFSIZE - 1, "%s %s", msg, path);
+        } else {
+            strncpy(logbuf, msg, BUFSIZE - 1);
+        }
+        if (store > 0) {
+            --store;
+        }
+    }
 }
+#endif
 
 static int
 logger_setup(void **state)
@@ -41,6 +54,30 @@
     return 0;
 }
 
+static int
+logger_teardown(void **state)
+{
+    (void) state; /* unused */
+#if ENABLE_LOGGER_CHECKING
+    if (*state) {
+        fprintf(stderr, "%s\n", logbuf);
+    }
+#endif
+    return 0;
+}
+
+void
+logbuf_clean(void)
+{
+    logbuf[0] = '\0';
+}
+
+#if ENABLE_LOGGER_CHECKING
+#   define logbuf_assert(str) assert_string_equal(logbuf, str)
+#else
+#   define logbuf_assert(str)
+#endif
+
 static void
 test_utf8(void **state)
 {
@@ -119,13 +156,45 @@
 }
 #endif /* not APPLE */
 
+static void
+test_parse_nodeid(void **state)
+{
+    (void) state; /* unused */
+    const char *str;
+    const char *prefix, *name;
+    size_t prefix_len, name_len;
+
+    str = "123";
+    assert_int_equal(LY_EINVAL, ly_parse_nodeid(&str, &prefix, &prefix_len, &name, &name_len));
+
+    str = "a12_-.!";
+    assert_int_equal(LY_SUCCESS, ly_parse_nodeid(&str, &prefix, &prefix_len, &name, &name_len));
+    assert_null(prefix);
+    assert_int_equal(0, prefix_len);
+    assert_non_null(name);
+    assert_int_equal(6, name_len);
+    assert_int_equal(0, strncmp("a12_-.", name, name_len));
+    assert_string_equal("!", str);
+
+    str = "a12_-.:_b2 xxx";
+    assert_int_equal(LY_SUCCESS, ly_parse_nodeid(&str, &prefix, &prefix_len, &name, &name_len));
+    assert_non_null(prefix);
+    assert_int_equal(6, prefix_len);
+    assert_int_equal(0, strncmp("a12_-.", prefix, prefix_len));
+    assert_non_null(name);
+    assert_int_equal(3, name_len);
+    assert_int_equal(0, strncmp("_b2", name, name_len));
+    assert_string_equal(" xxx", str);
+}
+
 int main(void)
 {
     const struct CMUnitTest tests[] = {
-        cmocka_unit_test_setup(test_utf8, logger_setup),
+        cmocka_unit_test_setup_teardown(test_utf8, logger_setup, logger_teardown),
 #ifndef APPLE
         cmocka_unit_test(test_lyrealloc),
 #endif
+        cmocka_unit_test_setup_teardown(test_parse_nodeid, logger_setup, logger_teardown),
     };
 
     return cmocka_run_group_tests(tests, NULL, NULL);
diff --git a/tests/src/test_tree_schema_helpers.c b/tests/src/test_tree_schema_helpers.c
index 563a2f8..5742d78 100644
--- a/tests/src/test_tree_schema_helpers.c
+++ b/tests/src/test_tree_schema_helpers.c
@@ -263,44 +263,12 @@
     ly_ctx_destroy(ctx, NULL);
 }
 
-static void
-test_parse_nodeid(void **state)
-{
-    (void) state; /* unused */
-    const char *str;
-    const char *prefix, *name;
-    size_t prefix_len, name_len;
-
-    str = "123";
-    assert_int_equal(LY_EINVAL, lys_parse_nodeid(&str, &prefix, &prefix_len, &name, &name_len));
-
-    str = "a12_-.!";
-    assert_int_equal(LY_SUCCESS, lys_parse_nodeid(&str, &prefix, &prefix_len, &name, &name_len));
-    assert_null(prefix);
-    assert_int_equal(0, prefix_len);
-    assert_non_null(name);
-    assert_int_equal(6, name_len);
-    assert_int_equal(0, strncmp("a12_-.", name, name_len));
-    assert_string_equal("!", str);
-
-    str = "a12_-.:_b2 xxx";
-    assert_int_equal(LY_SUCCESS, lys_parse_nodeid(&str, &prefix, &prefix_len, &name, &name_len));
-    assert_non_null(prefix);
-    assert_int_equal(6, prefix_len);
-    assert_int_equal(0, strncmp("a12_-.", prefix, prefix_len));
-    assert_non_null(name);
-    assert_int_equal(3, name_len);
-    assert_int_equal(0, strncmp("_b2", name, name_len));
-    assert_string_equal(" xxx", str);
-}
-
 int main(void)
 {
     const struct CMUnitTest tests[] = {
         cmocka_unit_test_setup_teardown(test_date, logger_setup, logger_teardown),
         cmocka_unit_test_setup(test_revisions, logger_setup),
         cmocka_unit_test_setup_teardown(test_typedef, logger_setup, logger_teardown),
-        cmocka_unit_test_setup(test_parse_nodeid, logger_setup),
     };
 
     return cmocka_run_group_tests(tests, NULL, NULL);
