1
0
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:
Dave Storey
2021-04-06 14:50:43 +01:00
committed by Pablo Santiago Blum de Aguiar
parent 11b70526f7
commit 70a42b54ab
3 changed files with 38 additions and 0 deletions

View 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