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