aPiecek | 266ca76 | 2023-03-22 15:04:59 +0100 | [diff] [blame] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}] |
| 2 | namespace import uti::regex_xml_elements uti::regex_json_pairs |
| 3 | |
| 4 | set modules {ietf-yang-library ietf-inet-types} |
| 5 | |
| 6 | test list_basic {basic test} { |
| 7 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 8 | ly_cmd "list" "ietf-yang-types" |
| 9 | }} |
| 10 | |
| 11 | test list_format_xml {list --format xml} { |
| 12 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 13 | ly_cmd "clear -y" |
| 14 | ly_cmd "list -f xml" [regex_xml_elements $modules "name"] |
| 15 | }} |
| 16 | |
| 17 | test list_format_json {list --format json} { |
| 18 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 19 | ly_cmd "clear -y" |
| 20 | ly_cmd "list -f json" [regex_json_pairs $modules "name"] |
| 21 | }} |
| 22 | |
| 23 | test list_ietf_yang_library {Error due to missing ietf-yang-library} { |
| 24 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 25 | ly_cmd_err "list -f xml" "Module \"ietf-yang-library\" is not implemented." |
| 26 | }} |
| 27 | |
| 28 | test list_bad_format {Error due to bad format} { |
| 29 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 30 | ly_cmd "clear -y" |
| 31 | ly_cmd_err "list -f csv" "Unknown output format csv" |
| 32 | }} |
| 33 | |
| 34 | cleanupTests |