-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
_ip_addresses: Add option to complete all/v4/v6 addresses, add unit test
- Loading branch information
Showing
2 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
proc setup {} { | ||
assert_bash_exec {unset COMPREPLY cur} | ||
save_env | ||
|
||
assert_bash_exec { \ | ||
_ia() { local cur=$(_get_cword);unset COMPREPLY;_ip_addresses; }; \ | ||
complete -F _ia ia \ | ||
} | ||
assert_bash_exec { \ | ||
_iaa() { local cur=$(_get_cword);unset COMPREPLY;_ip_addresses -a; }; \ | ||
complete -F _iaa iaa \ | ||
} | ||
assert_bash_exec { \ | ||
_ia6() { local cur=$(_get_cword);unset COMPREPLY;_ip_addresses -6; }; \ | ||
complete -F _ia6 ia6 \ | ||
} | ||
} | ||
|
||
proc teardown {} { | ||
assert_bash_exec {unset COMPREPLY cur} | ||
assert_bash_exec {unset -f _ia _iaa _ia6} | ||
assert_env_unmodified | ||
} | ||
|
||
setup | ||
|
||
|
||
# TODO: add/robustify conditions on expected failures or unsupported setups | ||
# ...so that there's no need for junk like CI/DIST special-casing | ||
|
||
set test "_ip_addresses should run without errors" | ||
assert_bash_exec {_ip_addresses} $test | ||
sync_after_int | ||
|
||
set test "_ip_addresses -a should complete ip addresses" | ||
assert_complete_any "iaa " | ||
sync_after_int | ||
|
||
set test "_ip_addresses should complete ipv4 addresses" | ||
assert_complete_any "ia " | ||
sync_after_int | ||
|
||
set test "_ip_addresses -6 should complete ipv6 addresses" | ||
if {[info exists ::env(CI)] && | ||
[info exists ::env(DIST)] && $::env(DIST) == "fedoradev"} { | ||
unsupported $test | ||
} else { | ||
assert_complete_any "ia6 " | ||
} | ||
sync_after_int | ||
|
||
|
||
teardown |