mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 15:12:20 +00:00 
			
		
		
		
	Fix rules.touch tests
				
					
				
			Move them to `rules` sub-directory and import `shells` instead of `and_` which in turn triggers the `generic_shell` fixture fixing the tests on Fish Shell.
This commit is contained in:
		
							
								
								
									
										29
									
								
								tests/rules/test_touch.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								tests/rules/test_touch.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| import pytest | ||||
| from thefuck.rules.touch import match, get_new_command | ||||
| from tests.utils import Command | ||||
|  | ||||
|  | ||||
| @pytest.fixture | ||||
| def stderr(): | ||||
|     return "touch: cannot touch '/a/b/c':" \ | ||||
|            " No such file or directory" | ||||
|  | ||||
|  | ||||
| def test_match(stderr): | ||||
|     command = Command( | ||||
|         'touch /a/b/c', stderr=stderr) | ||||
|     assert match(command) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('command', [ | ||||
|     Command('touch /a/b/c'), | ||||
|     Command('touch /a/b/c', stdout=stderr()), | ||||
|     Command('ls /a/b/c', stderr=stderr())]) | ||||
| def test_not_match(command): | ||||
|     assert not match(command) | ||||
|  | ||||
|  | ||||
| def test_get_new_command(stderr): | ||||
|     command = Command('touch /a/b/c', stderr=stderr) | ||||
|     fixed_command = get_new_command(command) | ||||
|     assert fixed_command == 'mkdir -p /a/b && touch /a/b/c' | ||||
		Reference in New Issue
	
	Block a user