mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 07:04:12 +00:00 
			
		
		
		
	
							
								
								
									
										13
									
								
								tests/rules/test_mkdir_p.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								tests/rules/test_mkdir_p.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| from thefuck.main import Command | ||||
| from thefuck.rules.mkdir_p import match, get_new_command | ||||
|  | ||||
|  | ||||
| def test_match(): | ||||
|     assert match(Command('mkdir foo/bar/baz', '', 'mkdir: foo/bar: No such file or directory'), None) | ||||
|     assert not match(Command('mkdir foo/bar/baz', '', ''), None) | ||||
|     assert not match(Command('mkdir foo/bar/baz', '', 'foo bar baz'), None) | ||||
|     assert not match(Command('', '', ''), None) | ||||
|  | ||||
|  | ||||
| def test_get_new_command(): | ||||
|     assert get_new_command(Command('mkdir foo/bar/baz', '', ''), None) == 'mkdir -p foo/bar/baz' | ||||
							
								
								
									
										9
									
								
								thefuck/rules/mkdir_p.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								thefuck/rules/mkdir_p.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| import re | ||||
|  | ||||
| def match(command, settings): | ||||
|     return ('mkdir' in command.script | ||||
|             and 'No such file or directory' in command.stderr) | ||||
|  | ||||
|  | ||||
| def get_new_command(command, settings): | ||||
|     return re.sub('^mkdir (.*)', 'mkdir -p \\1', command.script) | ||||
		Reference in New Issue
	
	Block a user