mirror of
				https://github.com/zsh-users/zsh-syntax-highlighting.git
				synced 2025-10-23 15:46:27 +08:00 
			
		
		
		
	tests: Use $unused_highlight in more places.
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.
This commit is contained in:
		
							parent
							
								
									00862cf4fa
								
							
						
					
					
						commit
						627eb71940
					
				| @ -28,6 +28,7 @@ | |||||||
| # vim: ft=zsh sw=2 ts=2 et | # vim: ft=zsh sw=2 ts=2 et | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| 
 | 
 | ||||||
|  | ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight | ||||||
| BUFFER='a+=(lorem ipsum)' | BUFFER='a+=(lorem ipsum)' | ||||||
| 
 | 
 | ||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ | |||||||
| # vim: ft=zsh sw=2 ts=2 et | # vim: ft=zsh sw=2 ts=2 et | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| 
 | 
 | ||||||
|  | ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight | ||||||
| BUFFER='A=1 b=("foo" bar)' | BUFFER='A=1 b=("foo" bar)' | ||||||
| 
 | 
 | ||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ | |||||||
| # vim: ft=zsh sw=2 ts=2 et | # vim: ft=zsh sw=2 ts=2 et | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| 
 | 
 | ||||||
|  | ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=$unused_highlight | ||||||
| BUFFER=": \$'*'" | BUFFER=": \$'*'" | ||||||
| 
 | 
 | ||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ | |||||||
| # vim: ft=zsh sw=2 ts=2 et | # vim: ft=zsh sw=2 ts=2 et | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| 
 | 
 | ||||||
|  | ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=$unused_highlight | ||||||
| BUFFER=$'echo "foo1\n' | BUFFER=$'echo "foo1\n' | ||||||
| 
 | 
 | ||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ | |||||||
| # vim: ft=zsh sw=2 ts=2 et | # vim: ft=zsh sw=2 ts=2 et | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| 
 | 
 | ||||||
|  | ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight | ||||||
| BUFFER='sudo -u otheruser ls /' | BUFFER='sudo -u otheruser ls /' | ||||||
| 
 | 
 | ||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Shahaf
						Daniel Shahaf