blob: 633fabb1753514303fec6d8799c9f117316cb967 [file] [log] [blame]
aPiecek266ca762023-03-22 15:04:59 +01001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
2
3variable ly_cleanup {
4 ly_ignore
5 ly_exit
6}
7
8test completion_hints_ietf_ip {Completion and hints for ietf-ip.yang} {
9-setup $ly_setup -cleanup $ly_cleanup -body {
10 ly_cmd "add $::env(YANG_MODULES_DIR)/ietf-ip.yang"
11
12 # completion and hint
13 ly_completion "print -f info -P " "print -f info -P /ietf-"
14
15 set hints {"/ietf-yang-schema-mount:schema-mounts" "/ietf-interfaces:interfaces" "/ietf-interfaces:interfaces-state"}
16 ly_hint "" "print -f info -P /ietf-" $hints
17
18 # double completion
19 ly_completion "i" "print -f info -P /ietf-interfaces:interfaces"
20 ly_completion "/" "print -f info -P /ietf-interfaces:interfaces/interface"
21
22 # a lot of hints
23 set hints {"/ietf-interfaces:interfaces/interface"
24 "/ietf-interfaces:interfaces/interface/name" "/ietf-interfaces:interfaces/interface/description"
25 "/ietf-interfaces:interfaces/interface/type" "/ietf-interfaces:interfaces/interface/enabled"
26 "/ietf-interfaces:interfaces/interface/link-up-down-trap-enable"
27 "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4" "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6"
28 }
29 ly_hint "" "print -f info -P /ietf-interfaces:interfaces/interface" $hints
30
31 # double tab
32 ly_completion "/i" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv"
33 ly_completion "4" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv4"
34 set hints { "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4" "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/enabled"
35 "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/forwarding" "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/mtu"
36 "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address" "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/neighbor"
37 }
38 ly_hint "\t" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv" $hints
39
40 # no more completion
41 ly_completion "/e" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv4/enabled "
42}}
43
44cleanupTests