blob: ab59a32d86b011170cb2ea548900bf64dba6064e [file] [log] [blame]
aPiecek266ca762023-03-22 15:04:59 +01001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
2namespace import uti::regex_xml_elements uti::regex_json_pairs
3
4set modules {ietf-yang-library ietf-inet-types}
5
6test list_basic {basic test} {
7-setup $ly_setup -cleanup $ly_cleanup -body {
8 ly_cmd "list" "ietf-yang-types"
9}}
10
11test 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
17test 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
23test 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
28test 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
34cleanupTests