mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
[Test] Clean up highlight tests
This commit is contained in:
parent
74197498fc
commit
cf146b6696
1 changed files with 14 additions and 7 deletions
|
@ -4,9 +4,16 @@ SCRIPT_DIR=$(dirname "$0")
|
||||||
TEST_DIR=$SCRIPT_DIR/../test
|
TEST_DIR=$SCRIPT_DIR/../test
|
||||||
DIST_DIR=$SCRIPT_DIR/../
|
DIST_DIR=$SCRIPT_DIR/../
|
||||||
|
|
||||||
|
# Use stub.sh for stubbing/mocking
|
||||||
|
source $TEST_DIR/stub-1.0.2.sh
|
||||||
|
|
||||||
source $DIST_DIR/zsh-autosuggestions.zsh
|
source $DIST_DIR/zsh-autosuggestions.zsh
|
||||||
|
|
||||||
testDefaultHighlightStyle() {
|
#--------------------------------------------------------------------#
|
||||||
|
# Highlighting #
|
||||||
|
#--------------------------------------------------------------------#
|
||||||
|
|
||||||
|
testHighlightDefaultStyle() {
|
||||||
assertEquals \
|
assertEquals \
|
||||||
"fg=8" \
|
"fg=8" \
|
||||||
"$ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
|
"$ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
|
||||||
|
@ -23,12 +30,12 @@ testHighlightApplyWithSuggestion() {
|
||||||
_zsh_autosuggest_highlight_apply
|
_zsh_autosuggest_highlight_apply
|
||||||
|
|
||||||
assertEquals \
|
assertEquals \
|
||||||
"adds to region_highlight with correct style" \
|
"highlight did not use correct style" \
|
||||||
"0 2 fg=1 2 10 $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE" \
|
"0 2 fg=1 2 10 $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE" \
|
||||||
"$region_highlight"
|
"$region_highlight"
|
||||||
|
|
||||||
assertEquals \
|
assertEquals \
|
||||||
"saves the higlight to be removed later" \
|
"higlight was not saved to be removed later" \
|
||||||
"2 10 $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE" \
|
"2 10 $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE" \
|
||||||
"$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT"
|
"$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT"
|
||||||
|
|
||||||
|
@ -43,12 +50,12 @@ testHighlightApplyWithoutSuggestion() {
|
||||||
_zsh_autosuggest_highlight_apply
|
_zsh_autosuggest_highlight_apply
|
||||||
|
|
||||||
assertEquals \
|
assertEquals \
|
||||||
"leaves region_highlight alone" \
|
"region_highlight was modified" \
|
||||||
"0 4 fg=1" \
|
"0 4 fg=1" \
|
||||||
"$region_highlight"
|
"$region_highlight"
|
||||||
|
|
||||||
assertNull \
|
assertNull \
|
||||||
"clears the last highlight" \
|
"last highlight region was not cleared" \
|
||||||
"$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT"
|
"$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,12 +68,12 @@ testHighlightReset() {
|
||||||
_zsh_autosuggest_highlight_reset
|
_zsh_autosuggest_highlight_reset
|
||||||
|
|
||||||
assertEquals \
|
assertEquals \
|
||||||
"removes last highlight region" \
|
"last highlight region was not removed" \
|
||||||
"0 1 fg=1 1 2 fg=1" \
|
"0 1 fg=1 1 2 fg=1" \
|
||||||
"$region_highlight"
|
"$region_highlight"
|
||||||
|
|
||||||
assertNull \
|
assertNull \
|
||||||
"clears the last highlight" \
|
"last highlight variable was not cleared" \
|
||||||
"$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT"
|
"$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue