mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	tests: Screen:expect: support "{MATCH:…}"
This commit is contained in:
		 Daniel Hahler
					Daniel Hahler
				
			
				
					committed by
					
						 Justin M. Keyes
						Justin M. Keyes
					
				
			
			
				
	
			
			
			 Justin M. Keyes
						Justin M. Keyes
					
				
			
						parent
						
							268252c8c7
						
					
				
				
					commit
					c0abaf9ca6
				
			| @@ -393,6 +393,8 @@ function Screen:expect(expected, attr_ids, ...) | |||||||
|       for i = 1, #expected_rows do |       for i = 1, #expected_rows do | ||||||
|         msg_expected_rows[i] = expected_rows[i] |         msg_expected_rows[i] = expected_rows[i] | ||||||
|         if expected_rows[i] ~= actual_rows[i] and expected_rows[i] ~= "{IGNORE}|" then |         if expected_rows[i] ~= actual_rows[i] and expected_rows[i] ~= "{IGNORE}|" then | ||||||
|  |           local m = expected_rows[i]:match('{MATCH:(.*)}') | ||||||
|  |           if not m or not actual_rows[i]:match(m) then | ||||||
|             msg_expected_rows[i] = '*' .. msg_expected_rows[i] |             msg_expected_rows[i] = '*' .. msg_expected_rows[i] | ||||||
|             if i <= #actual_rows then |             if i <= #actual_rows then | ||||||
|               actual_rows[i] = '*' .. actual_rows[i] |               actual_rows[i] = '*' .. actual_rows[i] | ||||||
| @@ -402,6 +404,7 @@ function Screen:expect(expected, attr_ids, ...) | |||||||
|             end |             end | ||||||
|           end |           end | ||||||
|         end |         end | ||||||
|  |       end | ||||||
|       if err_msg ~= nil then |       if err_msg ~= nil then | ||||||
|         return ( |         return ( | ||||||
|           err_msg..'\nExpected:\n  |'..table.concat(msg_expected_rows, '\n  |')..'\n' |           err_msg..'\nExpected:\n  |'..table.concat(msg_expected_rows, '\n  |')..'\n' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user