mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
46 lines
732 B
Bash
46 lines
732 B
Bash
#!/usr/bin/env zsh
|
|
|
|
source "${0:a:h}/../test_helper.zsh"
|
|
|
|
oneTimeSetUp() {
|
|
source_autosuggestions
|
|
}
|
|
|
|
setUp() {
|
|
BUFFER=''
|
|
POSTDISPLAY=''
|
|
}
|
|
|
|
tearDown() {
|
|
restore _zsh_autosuggest_invoke_original_widget
|
|
restore _zsh_autosuggest_suggestion
|
|
}
|
|
|
|
testModify() {
|
|
stub_and_eval \
|
|
_zsh_autosuggest_invoke_original_widget \
|
|
'BUFFER+="e"'
|
|
|
|
stub_and_echo \
|
|
_zsh_autosuggest_suggestion \
|
|
'echo hello'
|
|
|
|
_zsh_autosuggest_modify 'original-widget'
|
|
|
|
assertTrue \
|
|
'original widget not invoked' \
|
|
'stub_called _zsh_autosuggest_invoke_original_widget'
|
|
|
|
assertEquals \
|
|
'BUFFER was not modified' \
|
|
'e' \
|
|
"$BUFFER"
|
|
|
|
assertEquals \
|
|
'POSTDISPLAY does not contain suggestion' \
|
|
'cho hello' \
|
|
"$POSTDISPLAY"
|
|
|
|
}
|
|
|
|
run_tests "$0"
|