aPiecek | 9e0c190 | 2023-04-04 10:53:35 +0200 | [diff] [blame] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}] |
| 2 | |
| 3 | set mods "$::env(YANG_MODULES_DIR)/ietf-netconf-with-defaults@2011-06-01.yang $::env(YANG_MODULES_DIR)/moddefault.yang" |
| 4 | set data "$::env(TESTS_DIR)/data/moddefault.xml" |
| 5 | |
| 6 | test 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 | |
| 11 | test 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 | |
| 16 | test 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 | |
| 21 | test 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 | |
| 26 | test 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 | |
| 31 | cleanupTests |