aPiecek | 266ca76 | 2023-03-22 15:04:59 +0100 | [diff] [blame] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-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 {} { |
| 7 | ly_cmd "-l" "ietf-yang-types" |
| 8 | } {} |
| 9 | |
| 10 | test list_format_xml {list --format xml} { |
| 11 | ly_cmd "-y -f xml -l" [regex_xml_elements $modules "name"] |
| 12 | } {} |
| 13 | |
| 14 | test list_format_json {list --format json} { |
| 15 | ly_cmd "-y -f json -l" [regex_json_pairs $modules "name"] |
| 16 | } {} |
| 17 | |
aPiecek | 3426262 | 2023-03-27 08:28:25 +0200 | [diff] [blame] | 18 | test list_ietf_yang_library {Error due to missing ietf-yang-library} { |
| 19 | ly_cmd_err "-f xml -l" "Module \"ietf-yang-library\" is not implemented." |
| 20 | } {} |
| 21 | |
aPiecek | 266ca76 | 2023-03-22 15:04:59 +0100 | [diff] [blame] | 22 | test list_bad_format {Error due to bad format} { |
| 23 | ly_cmd_err "-f csv -l" "Unknown output format csv" |
| 24 | } {} |
| 25 | |
| 26 | cleanupTests |