mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-08 12:53:58 +01:00
#1184: Add new rule for main / master Git branches
This commit is contained in:
committed by
Pablo Santiago Blum de Aguiar
parent
11b70526f7
commit
70a42b54ab
23
tests/rules/test_git_main_master.py
Normal file
23
tests/rules/test_git_main_master.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import pytest
|
||||
from thefuck.rules.git_main_master import match, get_new_command
|
||||
from thefuck.types import Command
|
||||
|
||||
|
||||
output = 'error: pathspec \'%s\' did not match any file(s) known to git'
|
||||
|
||||
|
||||
def test_match():
|
||||
assert match(Command('git checkout main', output % ('main')))
|
||||
assert match(Command('git checkout master', output % ('master')))
|
||||
assert not match(Command('git checkout master', ''))
|
||||
assert not match(Command('git checkout main', ''))
|
||||
assert not match(Command('git checkout wibble', output % ('wibble')))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, new_command', [
|
||||
(Command('git checkout main', output % ('main')),
|
||||
'git checkout master'),
|
||||
(Command('git checkout master', output % ('master')),
|
||||
'git checkout main')])
|
||||
def test_get_new_command(command, new_command):
|
||||
assert get_new_command(command) == new_command
|
Reference in New Issue
Block a user