Follow-up to 547b8be30461: Fix $observed_result calculation.
In region_highlight, a spec of the form 'i j foo' with i >= j should have no effect.
Before this commit, however, the {$i..$j} range would happily expand to (5 4 3)
if i > j were the case (e.g., i=5 and j=3).
This breaks vanilla-newline.zsh; the next commit will fix that.
			
			
This commit is contained in:
		
							parent
							
								
									4068413dfe
								
							
						
					
					
						commit
						aab1b8f50f
					
				|  | @ -91,11 +91,16 @@ for data_file in ${0:h:h}/highlighters/$1/test-data/*.zsh; do | ||||||
|       for i in {1..${#region_highlight}}; do |       for i in {1..${#region_highlight}}; do | ||||||
|         highlight_zone=${(z)region_highlight[$i]} |         highlight_zone=${(z)region_highlight[$i]} | ||||||
|         integer start=$highlight_zone[1] end=$highlight_zone[2] |         integer start=$highlight_zone[1] end=$highlight_zone[2] | ||||||
|         (( --end )) # region_highlight ranges are half-open |         if (( start < end )) # region_highlight ranges are half-open | ||||||
|  |         then | ||||||
|  |           (( --end )) # convert to closed range, like expected_region_highlight | ||||||
|           (( ++start, ++end )) # region_highlight is 0-indexed; expected_region_highlight is 1-indexed |           (( ++start, ++end )) # region_highlight is 0-indexed; expected_region_highlight is 1-indexed | ||||||
|           for j in {$start..$end}; do |           for j in {$start..$end}; do | ||||||
|             observed_result[$j]=$highlight_zone[3] |             observed_result[$j]=$highlight_zone[3] | ||||||
|           done |           done | ||||||
|  |         else | ||||||
|  |           # noop range; ignore. | ||||||
|  |         fi | ||||||
|       done |       done | ||||||
| 
 | 
 | ||||||
|       # Then we compare the observed result with the expected one. |       # Then we compare the observed result with the expected one. | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue