aPiecek | 95709a4 | 2023-04-12 10:42:35 +0200 | [diff] [blame^] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}] |
| 2 | |
| 3 | set data "$::env(TESTS_DIR)/data/moddatanodes.xml" |
| 4 | |
| 5 | test data_xpath_empty {--xpath to missing node} { |
| 6 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 7 | ly_cmd "load moddatanodes" |
| 8 | ly_cmd "data -x /moddatanodes:dnc/mis $data" "Empty" |
| 9 | }} |
| 10 | |
| 11 | test data_xpath_leaf {--xpath to leaf node} { |
| 12 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 13 | ly_cmd "load moddatanodes" |
| 14 | ly_cmd "data -x /moddatanodes:dnc/lf $data" "leaf \"lf\" \\(value: \"x\"\\)" |
| 15 | }} |
| 16 | |
| 17 | test data_xpath_leaflist {--xpath to leaf-list node} { |
| 18 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 19 | ly_cmd "load moddatanodes" |
| 20 | set r1 "leaf-list \"lfl\" \\(value: \"1\"\\)" |
| 21 | set r2 "leaf-list \"lfl\" \\(value: \"2\"\\)" |
| 22 | ly_cmd "data -x /moddatanodes:dnc/lfl $data" "$r1\r\n $r2" |
| 23 | }} |
| 24 | |
| 25 | test data_xpath_list {--xpath to list} { |
| 26 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 27 | ly_cmd "load moddatanodes" |
| 28 | set r1 "list \"lt\" \\(\"kalf\": \"ka1\"; \"kblf\": \"kb1\";\\)" |
| 29 | set r2 "list \"lt\" \\(\"kalf\": \"ka2\"; \"kblf\": \"kb2\";\\)" |
| 30 | ly_cmd "data -x /moddatanodes:dnc/con/lt $data" "$r1\r\n $r2" |
| 31 | }} |
| 32 | |
| 33 | test data_xpath_err_default {--xpath cannot be combined with --default} { |
| 34 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 35 | ly_cmd "load moddatanodes ietf-netconf-with-defaults" |
| 36 | ly_cmd_err "data -d all -x /moddatanodes:dnc/lf $data" "option cannot be combined" |
| 37 | }} |
| 38 | |
| 39 | cleanupTests |