mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	add(rule): add the new git_diff_staged rule
This commit is contained in:
		
							
								
								
									
										27
									
								
								tests/rules/test_git_diff_staged.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								tests/rules/test_git_diff_staged.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| import pytest | ||||
| from thefuck.rules.git_diff_staged import match, get_new_command | ||||
| from tests.utils import Command | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('command', [ | ||||
|     Command(script='git diff'), | ||||
|     Command(script='git df'), | ||||
|     Command(script='git ds')]) | ||||
| def test_match(command): | ||||
|     assert match(command, None) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('command', [ | ||||
|     Command(script='git tag'), | ||||
|     Command(script='git branch'), | ||||
|     Command(script='git log')]) | ||||
| def test_not_match(command): | ||||
|     assert not match(command, None) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('command, new_command', [ | ||||
|     (Command('git diff'), 'git diff --staged'), | ||||
|     (Command('git df'), 'git df --staged'), | ||||
|     (Command('git ds'), 'git ds --staged')]) | ||||
| def test_get_new_command(command, new_command): | ||||
|     assert get_new_command(command, None) == new_command | ||||
		Reference in New Issue
	
	Block a user