blob: 201a5a998b92beaefee8e98f979614f71ae891d9 [file] [log] [blame]
aPieceka7366ac2023-04-06 10:36:58 +02001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
2
3set ddir $::env(TESTS_DIR)/data
4
5test data_no_strict_basic {} {
6-setup $ly_setup -cleanup $ly_cleanup -body {
7 ly_cmd "load modleaf"
8 ly_cmd_err "data $ddir/modmandatory.xml" "No module with namespace \"urn:yanglint:modmandatory\" in the context."
9 ly_cmd "data -n $ddir/modmandatory.xml"
10}}
11
12test data_no_strict_invalid_data {validation with --no-strict but data are invalid} {
13-setup $ly_setup -cleanup $ly_cleanup -body {
14 set errmsg "Mandatory node \"lft\" instance does not exist."
15 ly_cmd "load modmandatory"
16 ly_cmd_err "data -n $ddir/modmandatory_invalid.xml" $errmsg
17}}
18
19test data_no_strict_ignore_invalid_data {--no-strict ignore invalid data if no schema is provided} {
20-setup $ly_setup -cleanup $ly_cleanup -body {
21 ly_cmd "load modleaf"
22 ly_cmd "data -f xml -n $ddir/modmandatory_invalid.xml $ddir/modleaf.xml" "modleaf.*</lfl>$"
23}}
24
25cleanupTests