mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
46 lines
603 B
Bash
46 lines
603 B
Bash
|
#!/usr/bin/env zsh
|
||
|
|
||
|
source "${0:a:h}/test_helper.zsh"
|
||
|
|
||
|
oneTimeSetUp() {
|
||
|
source_autosuggestions
|
||
|
}
|
||
|
|
||
|
testInvokeOriginalWidgetDefined() {
|
||
|
stub_and_eval \
|
||
|
zle \
|
||
|
'return 1'
|
||
|
|
||
|
_zsh_autosuggest_invoke_original_widget 'self-insert'
|
||
|
|
||
|
assertEquals \
|
||
|
'1' \
|
||
|
"$?"
|
||
|
|
||
|
assertTrue \
|
||
|
'zle was not invoked' \
|
||
|
'stub_called zle'
|
||
|
|
||
|
restore zle
|
||
|
}
|
||
|
|
||
|
testInvokeOriginalWidgetUndefined() {
|
||
|
stub_and_eval \
|
||
|
zle \
|
||
|
'return 1'
|
||
|
|
||
|
_zsh_autosuggest_invoke_original_widget 'some-undefined-widget'
|
||
|
|
||
|
assertEquals \
|
||
|
'0' \
|
||
|
"$?"
|
||
|
|
||
|
assertFalse \
|
||
|
'zle was invoked' \
|
||
|
'stub_called zle'
|
||
|
|
||
|
restore zle
|
||
|
}
|
||
|
|
||
|
run_tests "$0"
|