summaryrefslogtreecommitdiffstats
path: root/tests/yanglint/interactive/data_not_strict.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/data_not_strict.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/data_not_strict.test')
-rw-r--r--tests/yanglint/interactive/data_not_strict.test25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/yanglint/interactive/data_not_strict.test b/tests/yanglint/interactive/data_not_strict.test
new file mode 100644
index 0000000..201a5a9
--- /dev/null
+++ b/tests/yanglint/interactive/data_not_strict.test
@@ -0,0 +1,25 @@
+source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
+
+set ddir $::env(TESTS_DIR)/data
+
+test data_no_strict_basic {} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modleaf"
+ ly_cmd_err "data $ddir/modmandatory.xml" "No module with namespace \"urn:yanglint:modmandatory\" in the context."
+ ly_cmd "data -n $ddir/modmandatory.xml"
+}}
+
+test data_no_strict_invalid_data {validation with --no-strict but data are invalid} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ set errmsg "Mandatory node \"lft\" instance does not exist."
+ ly_cmd "load modmandatory"
+ ly_cmd_err "data -n $ddir/modmandatory_invalid.xml" $errmsg
+}}
+
+test data_no_strict_ignore_invalid_data {--no-strict ignore invalid data if no schema is provided} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+ ly_cmd "load modleaf"
+ ly_cmd "data -f xml -n $ddir/modmandatory_invalid.xml $ddir/modleaf.xml" "modleaf.*</lfl>$"
+}}
+
+cleanupTests