Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/modules/yang/test-module.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module test-module {
yang-version 1.1;
namespace "test-module:test-module";
prefix test-module;

list l1 {key k; leaf k {type string;} leaf v {type string;}}
}
20 changes: 20 additions & 0 deletions tests/utests/basic/test_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,26 @@ test_ylmem(void **state)
/* seperate context to avoid double free during teadown */
struct ly_ctx *ctx_test = NULL;

const char *yanglibrary_json =
"{"
" \"ietf-yang-library:modules-state\": {"
" \"module-set-id\": \"e595da11ace92c0d881995fa7e56bbe86f1f48e9\","
" \"module\": ["
" {"
" \"name\": \"test-module\","
" \"revision\": \"2025-01-29\","
" \"namespace\": \"test-module:test-module\","
" \"conformance-type\": \"implement\""
" }"
" ]"
" },"
" \"ietf-yang-library:yang-library\": {"
" \"content-id\": \"321566\""
" }"
"}";

assert_int_equal(LY_SUCCESS, ly_ctx_new_ylmem(TESTS_SRC "/modules/yang/", yanglibrary_json, LYD_JSON, 0, &ctx_test));

/* test invalid parameters */
assert_int_equal(LY_EINVAL, ly_ctx_new_ylpath(NULL, NULL, LYD_XML, 0, &ctx_test));
assert_int_equal(LY_EINVAL, ly_ctx_new_ylpath(NULL, TESTS_SRC, LYD_XML, 0, NULL));
Expand Down
Loading