From 871af6808284b09d4df0dbda1befd579829bade7 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 27 Oct 2015 05:09:13 +0000 Subject: [PATCH] sudo: Extend test to cover all codepaths. --- highlighters/main/test-data/sudo-command.zsh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/highlighters/main/test-data/sudo-command.zsh b/highlighters/main/test-data/sudo-command.zsh index 6e84179..437d5eb 100644 --- a/highlighters/main/test-data/sudo-command.zsh +++ b/highlighters/main/test-data/sudo-command.zsh @@ -28,12 +28,18 @@ # ------------------------------------------------------------------------------------------------- ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight -BUFFER='sudo -u otheruser ls /' +# Tests three codepaths: +# * -i (no argument) +# * -C3 (pasted argument) +# * -u otheruser (non-pasted argument) +BUFFER='sudo -C3 -u otheruser -i ls /' expected_region_highlight=( "1 4 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo - "6 7 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -u - "9 17 $ZSH_HIGHLIGHT_STYLES[default]" # otheruser - "19 20 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "22 22 $ZSH_HIGHLIGHT_STYLES[path]" # / + "6 8 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -C3 + "10 11 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -u + "13 21 $ZSH_HIGHLIGHT_STYLES[default]" # otheruser + "23 24 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -i + "26 27 $ZSH_HIGHLIGHT_STYLES[command]" # ls + "29 29 $ZSH_HIGHLIGHT_STYLES[path]" # / )