summaryrefslogtreecommitdiffstats
path: root/tests/yanglint/interactive/clear.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-23 09:41:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-23 11:00:43 +0000
commitd0b1bae8c5c70c5d06f3dcecc450a75e7f7cb5af (patch)
tree7ea7c5e622a5d7c9c989057a1eca8954c4d7fefb /tests/yanglint/interactive/clear.test
parentInitial commit. (diff)
downloadlibyang3-d0b1bae8c5c70c5d06f3dcecc450a75e7f7cb5af.tar.xz
libyang3-d0b1bae8c5c70c5d06f3dcecc450a75e7f7cb5af.zip
Adding upstream version 3.1.0+dfsg.upstream/3.1.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/yanglint/interactive/clear.test')
-rw-r--r--tests/yanglint/interactive/clear.test53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/yanglint/interactive/clear.test b/tests/yanglint/interactive/clear.test
new file mode 100644
index 0000000..cac0810
--- /dev/null
+++ b/tests/yanglint/interactive/clear.test
@@ -0,0 +1,53 @@
+source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
+
+set mdir $::env(YANG_MODULES_DIR)
+set ddir $::env(TESTS_DIR)/data
+
+test clear_searchpath {searchpath is also deleted} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "searchpath ./"
+ ly_cmd "clear"
+ ly_cmd "searchpath" "List of the searchpaths:" -ex
+}}
+
+test clear_make_implemented_once {clear --make-implemented} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "clear -i"
+ ly_cmd "add $mdir/modmust.yang"
+ ly_cmd "list" "I modmust\r.*I modleaf"
+}}
+
+test clear_make_implemented_twice {clear -i -i} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "clear -i -i"
+ ly_cmd "add $mdir/modmust.yang"
+ ly_cmd "list" "I modmust\r.*I modleaf"
+}}
+
+test clear_ietf_yang_library {clear --yang-library} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ # add models
+ ly_cmd "clear -y"
+ ly_cmd "list" "I ietf-yang-library"
+}}
+
+test clear_ylf_list {apply --yang-library-file and check result by --list} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "clear -Y $ddir/modimp_type_ctx.xml"
+ ly_cmd "list" "I modimp-type.*i modtypedef"
+}}
+
+test clear_ylf_make_implemented {apply --yang-library-file and --make-implemented} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "clear -Y $ddir/modimp_type_ctx.xml -i -i"
+ ly_cmd "list" "I modimp-type.*I modtypedef"
+}}
+
+test clear_ylf_augment_ctx {Setup context by yang-library-file and augment module} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "clear -Y $ddir/modconfig_ctx.xml"
+ ly_cmd "add $mdir/modconfig-augment.yang"
+ ly_cmd "print -f tree modconfig" "mca:alf"
+}}
+
+cleanupTests