mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 07:04:12 +00:00 
			
		
		
		
	#N/A: Add new git_branch_delete_checked_out rule (#985)
				
					
				
			This commit is contained in:
		
				
					committed by
					
						 Vladimir Iakovlev
						Vladimir Iakovlev
					
				
			
			
				
	
			
			
			
						parent
						
							0ccb34bde8
						
					
				
				
					commit
					80cfd6991d
				
			
							
								
								
									
										29
									
								
								tests/rules/test_git_branch_delete_checked_out.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								tests/rules/test_git_branch_delete_checked_out.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| import pytest | ||||
| from thefuck.rules.git_branch_delete_checked_out import match, get_new_command | ||||
| from thefuck.types import Command | ||||
|  | ||||
|  | ||||
| @pytest.fixture | ||||
| def output(): | ||||
|     return "error: Cannot delete branch 'foo' checked out at '/bar/foo'" | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize("script", ["git branch -d foo", "git branch -D foo"]) | ||||
| def test_match(script, output): | ||||
|     assert match(Command(script, output)) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize("script", ["git branch -d foo", "git branch -D foo"]) | ||||
| def test_not_match(script): | ||||
|     assert not match(Command(script, "Deleted branch foo (was a1b2c3d).")) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize( | ||||
|     "script, new_command", | ||||
|     [ | ||||
|         ("git branch -d foo", "git checkout master && git branch -D foo"), | ||||
|         ("git branch -D foo", "git checkout master && git branch -D foo"), | ||||
|     ], | ||||
| ) | ||||
| def test_get_new_command(script, new_command, output): | ||||
|     assert get_new_command(Command(script, output)) == new_command | ||||
		Reference in New Issue
	
	Block a user