yanglint TEST options --type with data or config
diff --git a/tools/lint/tests/data/modconfig.xml b/tools/lint/tests/data/modconfig.xml
new file mode 100644
index 0000000..f8a03a9
--- /dev/null
+++ b/tools/lint/tests/data/modconfig.xml
@@ -0,0 +1,4 @@
+<mcc xmlns="urn:yanglint:modconfig">
+ <lft>rw</lft>
+ <lff>ro</lff>
+</mcc>
diff --git a/tools/lint/tests/data/modconfig2.xml b/tools/lint/tests/data/modconfig2.xml
new file mode 100644
index 0000000..c96e344
--- /dev/null
+++ b/tools/lint/tests/data/modconfig2.xml
@@ -0,0 +1,3 @@
+<mcc xmlns="urn:yanglint:modconfig">
+ <lft>rw</lft>
+</mcc>
diff --git a/tools/lint/tests/interactive/data_type.test b/tools/lint/tests/interactive/data_type.test
new file mode 100644
index 0000000..db93af4
--- /dev/null
+++ b/tools/lint/tests/interactive/data_type.test
@@ -0,0 +1,18 @@
+source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
+
+set ddir "$::env(TESTS_DIR)/data"
+
+test data_type_data {data --type data} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modconfig"
+ ly_cmd "data -t data $ddir/modconfig.xml"
+}}
+
+test data_type_config {data --type config} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modconfig"
+ ly_cmd_err "data -t config $ddir/modconfig.xml" "Unexpected data state node \"lff\""
+ ly_cmd "data -t config $ddir/modconfig2.xml"
+}}
+
+cleanupTests
diff --git a/tools/lint/tests/modules/modconfig.yang b/tools/lint/tests/modules/modconfig.yang
new file mode 100644
index 0000000..1d12ca6
--- /dev/null
+++ b/tools/lint/tests/modules/modconfig.yang
@@ -0,0 +1,17 @@
+module modconfig {
+ namespace "urn:yanglint:modconfig";
+ prefix mc;
+
+ container mcc {
+ leaf lft {
+ type string;
+ config true;
+ mandatory true;
+ }
+ leaf lff {
+ type string;
+ config false;
+ mandatory true;
+ }
+ }
+}
diff --git a/tools/lint/tests/non-interactive/data_type.test b/tools/lint/tests/non-interactive/data_type.test
new file mode 100644
index 0000000..9631b22
--- /dev/null
+++ b/tools/lint/tests/non-interactive/data_type.test
@@ -0,0 +1,15 @@
+source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}]
+
+set mdir "$::env(YANG_MODULES_DIR)"
+set ddir "$::env(TESTS_DIR)/data"
+
+test data_type_data {data --type data} {
+ ly_cmd "-t data $mdir/modconfig.yang $ddir/modconfig.xml"
+} {}
+
+test data_type_config {data --type config} {
+ ly_cmd_err "-t config $mdir/modconfig.yang $ddir/modconfig.xml" "Unexpected data state node \"lff\""
+ ly_cmd "-t config $mdir/modconfig.yang $ddir/modconfig2.xml"
+} {}
+
+cleanupTests