mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	Add: rules/go_unknown_command for misspelled go commands. (#933)
* - Add: rules/go_unknown_command for misspelled go commands. - Add: tests/test_go_unknown_command which tests match and mismatch case of rules/go_unknown_command. - Change: Added description of go_unknown_command to README.md. * Add: test_get_new_command for testing rules.go_unknown_command.test_get_new_command method. * Change: go_unknown_command.match now uses for_app decorator. * Add: get_golang_commands which dynamically gets golang possible commands. * Fix: cache proper function instead of its result.
This commit is contained in:
		
							
								
								
									
										21
									
								
								tests/rules/test_go_unknown_command.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								tests/rules/test_go_unknown_command.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| import pytest | ||||
| from thefuck.rules.go_unknown_command import match, get_new_command | ||||
| from thefuck.types import Command | ||||
|  | ||||
|  | ||||
| @pytest.fixture | ||||
| def build_misspelled_output(): | ||||
|     return '''go bulid: unknown command | ||||
| Run 'go help' for usage.''' | ||||
|  | ||||
|  | ||||
| def test_match(build_misspelled_output): | ||||
|     assert match(Command('go bulid', build_misspelled_output)) | ||||
|  | ||||
|  | ||||
| def test_not_match(): | ||||
|     assert not match(Command('go run', 'go run: no go files listed')) | ||||
|  | ||||
|  | ||||
| def test_get_new_command(build_misspelled_output): | ||||
|     assert get_new_command(Command('go bulid', build_misspelled_output)) == 'go build' | ||||
		Reference in New Issue
	
	Block a user