test harness: Don't leak options from test files to the test harness.
Fixes an issue whereby the '# TODO "issue #687"' directive in the output of opt-shwordsplit1.zsh was truncated, because the test itself had set the SH_WORD_SPLIT option and that affected the evaluation of «${(z)expected_region_highlight[i]}» in the test harness. Furthermore, this patch also independently fixes the error under zsh-5.0.8 and earlier that was fixed by the previous commit.
This commit is contained in:
		
							parent
							
								
									99389327ae
								
							
						
					
					
						commit
						e6eea1f9b7
					
				|  | @ -123,20 +123,27 @@ run_test_internal() { | ||||||
|   local skip_mismatch |   local skip_mismatch | ||||||
|   local -a expected_region_highlight region_highlight |   local -a expected_region_highlight region_highlight | ||||||
| 
 | 
 | ||||||
|   . "$srcdir"/"$1" |   local ARG="$1" | ||||||
|  |   () { | ||||||
|  |     setopt localoptions | ||||||
|  |     . "$srcdir"/"$ARG" | ||||||
| 
 | 
 | ||||||
|   (( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return; } |     # WARNING: The remainder of this anonymous function will run with the test's options in effect | ||||||
| 
 | 
 | ||||||
|   # Check the data declares $PREBUFFER or $BUFFER. |     (( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return; } | ||||||
|   [[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! On ${(qq)1}: Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; } |  | ||||||
|   # Check the data declares $expected_region_highlight. |  | ||||||
|   (( $+expected_region_highlight == 0 )) && { echo >&2 "Bail out! On ${(qq)1}: 'expected_region_highlight' is not declared."; return 1; } |  | ||||||
| 
 | 
 | ||||||
|   # Set sane defaults for ZLE variables |     # Check the data declares $PREBUFFER or $BUFFER. | ||||||
|   : ${CURSOR=$#BUFFER} ${PENDING=0} ${WIDGET=z-sy-h-test-harness-test-widget} |     [[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! On ${(qq)1}: Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; } | ||||||
|  |     # Check the data declares $expected_region_highlight. | ||||||
|  |     (( $+expected_region_highlight == 0 )) && { echo >&2 "Bail out! On ${(qq)1}: 'expected_region_highlight' is not declared."; return 1; } | ||||||
| 
 | 
 | ||||||
|   # Process the data. |     # Set sane defaults for ZLE variables | ||||||
|   _zsh_highlight |     : ${CURSOR=$#BUFFER} ${PENDING=0} ${WIDGET=z-sy-h-test-harness-test-widget} | ||||||
|  | 
 | ||||||
|  |     # Process the data. | ||||||
|  |     _zsh_highlight | ||||||
|  |   } | ||||||
|  |   unset ARG | ||||||
| 
 | 
 | ||||||
|   if (( unsorted )); then |   if (( unsorted )); then | ||||||
|     region_highlight=("${(@n)region_highlight}") |     region_highlight=("${(@n)region_highlight}") | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue