summaryrefslogtreecommitdiffstats
path: root/tests/yanglint/non-interactive/data_present.test
blob: 81aac1401f94b945d295e098eb69b2b8a812d478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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_present_via_mandatory {validation of mandatory-stmt will pass only with the --present} {
    set mods "$mdir/modleaf.yang $mdir/modmandatory.yang"
    ly_cmd_err "$ddir/modleaf.xml $mods" "Mandatory node \"lft\" instance does not exist."
    ly_cmd "-e $ddir/modleaf.xml $mods"
} {}

test data_present_merge {validation with --present and --merge} {
    set mods "$mdir/modleaf.yang $mdir/modmandatory.yang $mdir/moddefault.yang"
    set data "$ddir/modleaf.xml $ddir/moddefault.xml"
    ly_cmd_err "-m $data $mods" "Mandatory node \"lft\" instance does not exist."
    ly_cmd "-m -e $data $mods"
} {}

test data_present_merge_invalid {using --present and --merge but data are invalid} {
    set mods "$mdir/modleaf.yang $mdir/modmandatory.yang"
    set data "$ddir/modleaf.xml $ddir/modmandatory_invalid.xml"
    ly_cmd_err "-e -m  $data $mods" "Mandatory node \"lft\" instance does not exist."
} {}

cleanupTests