aPiecek | 9e0c190 | 2023-04-04 10:53:35 +0200 | [diff] [blame] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}] |
| 2 | |
| 3 | set mods "ietf-netconf-with-defaults moddefault" |
| 4 | set data "$::env(TESTS_DIR)/data/moddefault.xml" |
| 5 | |
| 6 | test 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 | |
| 13 | test 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 | |
| 20 | test 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 | |
| 27 | test 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 | |
| 34 | test 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 | |
| 41 | cleanupTests |