yanglint TEST option make-implemented
diff --git a/tools/lint/tests/interactive/add.test b/tools/lint/tests/interactive/add.test
index 33ba6a6..85d36bb 100644
--- a/tools/lint/tests/interactive/add.test
+++ b/tools/lint/tests/interactive/add.test
@@ -2,6 +2,12 @@
set mdir $::env(YANG_MODULES_DIR)
+test add_basic {} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "add $mdir/modleafref.yang"
+ ly_cmd "list" "I modleafref\r.*I modleaf"
+}}
+
test add_disable_searchdir_once {add --disable-searchdir} {
-setup $ly_setup -cleanup $ly_cleanup -constraints {!ctest} -body {
ly_cmd "add $mdir/modimp-cwd.yang"
@@ -22,4 +28,22 @@
ly_cmd "feature -a" "modfeature:\r\n\tftr1 \\(off\\)\r\n\tftr2 \\(on\\)"
}}
+test add_make_implemented_once {add --make-implemented} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_ignore "add $mdir/modmust.yang"
+ ly_cmd "list" "I modmust\r.*i modleaf"
+ ly_cmd "clear"
+ ly_ignore "add -i $mdir/modmust.yang"
+ ly_cmd "list" "I modmust\r.*I modleaf"
+}}
+
+test add_make_implemented_twice {add -i -i} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "add $mdir/modimp-type.yang"
+ ly_cmd "list" "I modimp-type\r.*i modtypedef"
+ ly_cmd "clear"
+ ly_cmd "add -i -i $mdir/modimp-type.yang"
+ ly_cmd "list" "I modimp-type\r.*I modtypedef"
+}}
+
cleanupTests
diff --git a/tools/lint/tests/interactive/clear.test b/tools/lint/tests/interactive/clear.test
index 5a247c9..56481c5 100644
--- a/tools/lint/tests/interactive/clear.test
+++ b/tools/lint/tests/interactive/clear.test
@@ -1,5 +1,21 @@
source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
+set mdir $::env(YANG_MODULES_DIR)
+
+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
diff --git a/tools/lint/tests/interactive/load.test b/tools/lint/tests/interactive/load.test
index f13bce9..382b9e9 100644
--- a/tools/lint/tests/interactive/load.test
+++ b/tools/lint/tests/interactive/load.test
@@ -1,9 +1,35 @@
source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
+test load_basic {} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modleafref"
+ ly_cmd "list" "I modleafref\r.*I modleaf"
+}}
+
test load_with_feature {Load module with feature} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load --feature modfeature:ftr2 modfeature"
ly_cmd "feature -a" "modfeature:\r\n\tftr1 \\(off\\)\r\n\tftr2 \\(on\\)"
}}
+test load_make_implemented_once {load --make-implemented} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_ignore "load modmust"
+ ly_cmd "list" "I modmust\r.*i modleaf"
+ ly_cmd "clear"
+ ly_cmd "searchpath $::env(YANG_MODULES_DIR)"
+ ly_cmd "load -i modmust"
+ ly_cmd "list" "I modmust\r.*I modleaf"
+}}
+
+test load_make_implemented_twice {load -i -i} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modimp-type"
+ ly_cmd "list" "I modimp-type\r.*i modtypedef"
+ ly_cmd "clear"
+ ly_cmd "searchpath $::env(YANG_MODULES_DIR)"
+ ly_cmd "load -i -i modimp-type"
+ ly_cmd "list" "I modimp-type\r.*I modtypedef"
+}}
+
cleanupTests
diff --git a/tools/lint/tests/modules/modimp-type.yang b/tools/lint/tests/modules/modimp-type.yang
new file mode 100644
index 0000000..ec21d31
--- /dev/null
+++ b/tools/lint/tests/modules/modimp-type.yang
@@ -0,0 +1,12 @@
+module modimp-type {
+ namespace "urn:yanglint:modimp-type";
+ prefix mit;
+
+ import modtypedef {
+ prefix mtd;
+ }
+
+ leaf lf {
+ type mtd:mui8;
+ }
+}
diff --git a/tools/lint/tests/modules/modleafref.yang b/tools/lint/tests/modules/modleafref.yang
new file mode 100644
index 0000000..f86fb3f
--- /dev/null
+++ b/tools/lint/tests/modules/modleafref.yang
@@ -0,0 +1,14 @@
+module modleafref {
+ namespace "urn:yanglint:modleafref";
+ prefix m;
+
+ import modleaf {
+ prefix ml;
+ }
+
+ leaf lfr {
+ type leafref {
+ path "/ml:lfl";
+ }
+ }
+}
diff --git a/tools/lint/tests/modules/modmust.yang b/tools/lint/tests/modules/modmust.yang
new file mode 100644
index 0000000..99971bd
--- /dev/null
+++ b/tools/lint/tests/modules/modmust.yang
@@ -0,0 +1,13 @@
+module modmust {
+ namespace "urn:yanglint:modmust";
+ prefix m;
+
+ import modleaf {
+ prefix ml;
+ }
+
+ leaf lfm {
+ type string;
+ must "/ml:lfl > 0";
+ }
+}
diff --git a/tools/lint/tests/modules/modtypedef.yang b/tools/lint/tests/modules/modtypedef.yang
new file mode 100644
index 0000000..ea09c95
--- /dev/null
+++ b/tools/lint/tests/modules/modtypedef.yang
@@ -0,0 +1,8 @@
+module modtypedef {
+ namespace "urn:yanglint:typedef";
+ prefix mt;
+
+ typedef mui8 {
+ type uint8;
+ }
+}
diff --git a/tools/lint/tests/non-interactive/make_implemented.test b/tools/lint/tests/non-interactive/make_implemented.test
new file mode 100644
index 0000000..40cead9
--- /dev/null
+++ b/tools/lint/tests/non-interactive/make_implemented.test
@@ -0,0 +1,17 @@
+source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}]
+
+set mdir $::env(YANG_MODULES_DIR)
+
+test make_impl_no_set {Import while --make-implemented is not set} {
+ ly_cmd "-l $mdir/modleafref.yang" "I modleafref\n.*I modleaf"
+} {}
+
+test make_impl_set_once {--make-implemented} {
+ ly_cmd "-l -i $mdir/modmust.yang" "I modmust\n.*I modleaf"
+} {}
+
+test make_impl_set_twice {-i -i} {
+ ly_cmd "-l -i -i $mdir/modimp-type.yang" "I modimp-type\n.*I modtypedef"
+} {}
+
+cleanupTests