blob: be19d72c6c0756d7ec50d25eb765f85002c3064e [file] [log] [blame]
aPiecek9e0c1902023-04-04 10:53:35 +02001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}]
2
3set mods "$::env(YANG_MODULES_DIR)/ietf-netconf-with-defaults@2011-06-01.yang $::env(YANG_MODULES_DIR)/moddefault.yang"
4set data "$::env(TESTS_DIR)/data/moddefault.xml"
5
6test data_default_not_set {Print data without --default parameter} {
7 ly_cmd "-f xml $mods $data" "</lf>.*</di>\n</mdc>"
8 ly_cmd "-f json $mods $data" "lf\".*di\"\[^\"]*"
9} {}
10
11test data_default_all {data --default all} {
12 ly_cmd "-d all -f xml $mods $data" "</lf>.*</di>.*</ds>\n</mdc>"
13 ly_cmd "-d all -f json $mods $data" "lf\".*di\".*ds\"\[^\"]*"
14} {}
15
16test data_default_all_tagged {data --default all-tagged} {
17 ly_cmd "-d all-tagged -f xml $mods $data" "</lf>.*<di.*default.*</di>.*<ds.*default.*</ds>\n</mdc>"
18 ly_cmd "-d all-tagged -f json $mods $data" "lf\".*di\".*ds\".*@ds\".*default\"\[^\"]*"
19} {}
20
21test data_default_trim {data --default trim} {
22 ly_cmd "-d trim -f xml $mods $data" "</lf>\n</mdc>"
23 ly_cmd "-d trim -f json $mods $data" "lf\"\[^\"]*"
24} {}
25
26test data_default_implicit_tagged {data --default implicit-tagged} {
27 ly_cmd "-d implicit-tagged -f xml $mods $data" "</lf>.*<di>5</di>.*<ds.*default.*</ds>\n</mdc>"
28 ly_cmd "-d implicit-tagged -f json $mods $data" "lf\".*di\"\[^@]*ds\".*default\"\[^\"]*"
29} {}
30
31cleanupTests