Clean up tests with setUp and tearDown functions

This commit is contained in:
Eric Freese
2016-03-15 09:05:55 -06:00
parent a28e72e84a
commit ba7109169d
4 changed files with 46 additions and 3 deletions

View File

@@ -6,10 +6,17 @@ oneTimeSetUp() {
source_autosuggestions
}
testModify() {
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"'
@@ -34,8 +41,6 @@ testModify() {
'cho hello' \
"$POSTDISPLAY"
restore _zsh_autosuggest_invoke_original_widget
restore _zsh_autosuggest_suggestion
}
run_tests "$0"