From 627eb719406c3e1a96f12072413115d53207f1b0 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 18 Sep 2015 18:44:18 +0000 Subject: [PATCH] tests: Use $unused_highlight in more places. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Notably, the 'single-hyphen-option' and 'assign' contexts both default to the 'none' style, so before this patch, the tests would not have detected a failure to apply those two contexts. For other contexts, using $unused_highlight only helps detect the case where the right highlight style (e.g., 'fg=yellow') is used as a result of applying the wrong context — which should be a theoretical failure mode. This is part of zsh-users/zsh-syntax-highlighting#198. --- highlighters/main/test-data/assign-append.zsh | 1 + highlighters/main/test-data/assign.zsh | 1 + highlighters/main/test-data/dollar-quoted.zsh | 1 + highlighters/main/test-data/multiline-string2.zsh | 1 + highlighters/main/test-data/sudo-command.zsh | 1 + 5 files changed, 5 insertions(+) diff --git a/highlighters/main/test-data/assign-append.zsh b/highlighters/main/test-data/assign-append.zsh index 29e759a..973e74c 100644 --- a/highlighters/main/test-data/assign-append.zsh +++ b/highlighters/main/test-data/assign-append.zsh @@ -28,6 +28,7 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- +ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight BUFFER='a+=(lorem ipsum)' expected_region_highlight=( diff --git a/highlighters/main/test-data/assign.zsh b/highlighters/main/test-data/assign.zsh index 61edd6d..7351fa9 100644 --- a/highlighters/main/test-data/assign.zsh +++ b/highlighters/main/test-data/assign.zsh @@ -28,6 +28,7 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- +ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight BUFFER='A=1 b=("foo" bar)' expected_region_highlight=( diff --git a/highlighters/main/test-data/dollar-quoted.zsh b/highlighters/main/test-data/dollar-quoted.zsh index 7906d3e..31f8f5a 100644 --- a/highlighters/main/test-data/dollar-quoted.zsh +++ b/highlighters/main/test-data/dollar-quoted.zsh @@ -28,6 +28,7 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- +ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=$unused_highlight BUFFER=": \$'*'" expected_region_highlight=( diff --git a/highlighters/main/test-data/multiline-string2.zsh b/highlighters/main/test-data/multiline-string2.zsh index 03626af..d460d6e 100644 --- a/highlighters/main/test-data/multiline-string2.zsh +++ b/highlighters/main/test-data/multiline-string2.zsh @@ -28,6 +28,7 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- +ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=$unused_highlight BUFFER=$'echo "foo1\n' expected_region_highlight=( diff --git a/highlighters/main/test-data/sudo-command.zsh b/highlighters/main/test-data/sudo-command.zsh index ce19f0c..cf229c9 100644 --- a/highlighters/main/test-data/sudo-command.zsh +++ b/highlighters/main/test-data/sudo-command.zsh @@ -28,6 +28,7 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- +ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight BUFFER='sudo -u otheruser ls /' expected_region_highlight=(