blob: 81aac1401f94b945d295e098eb69b2b8a812d478 [file] [log] [blame]
aPiecekaa285692023-04-05 13:36:25 +02001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}]
2
3set mdir $::env(YANG_MODULES_DIR)
4set ddir $::env(TESTS_DIR)/data
5
6test data_present_via_mandatory {validation of mandatory-stmt will pass only with the --present} {
7 set mods "$mdir/modleaf.yang $mdir/modmandatory.yang"
8 ly_cmd_err "$ddir/modleaf.xml $mods" "Mandatory node \"lft\" instance does not exist."
9 ly_cmd "-e $ddir/modleaf.xml $mods"
10} {}
11
aPiecek65de6d12023-04-05 13:38:53 +020012test data_present_merge {validation with --present and --merge} {
13 set mods "$mdir/modleaf.yang $mdir/modmandatory.yang $mdir/moddefault.yang"
14 set data "$ddir/modleaf.xml $ddir/moddefault.xml"
15 ly_cmd_err "-m $data $mods" "Mandatory node \"lft\" instance does not exist."
16 ly_cmd "-m -e $data $mods"
17} {}
18
aPiecekaa285692023-04-05 13:36:25 +020019test data_present_merge_invalid {using --present and --merge but data are invalid} {
20 set mods "$mdir/modleaf.yang $mdir/modmandatory.yang"
21 set data "$ddir/modleaf.xml $ddir/modmandatory_invalid.xml"
22 ly_cmd_err "-e -m $data $mods" "Mandatory node \"lft\" instance does not exist."
23} {}
24
25cleanupTests