1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-09-18 19:22:32 +01:00

Add the git_fix_stash rule

This commit is contained in:
mcarton
2015-07-22 23:16:12 +02:00
parent ab1cd665cd
commit e4da8a2e5a
3 changed files with 72 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
import pytest
from thefuck.rules.git_fix_stash import match, get_new_command
from tests.utils import Command
git_stash_err = '''
usage: git stash list [<options>]
or: git stash show [<stash>]
or: git stash drop [-q|--quiet] [<stash>]
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: git stash branch <branchname> [<stash>]
or: git stash [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [<message>]]
or: git stash clear
'''
@pytest.mark.parametrize('wrong', [
'git stash opp',
'git stash Some message',
'git stash saev Some message'])
def test_match(wrong):
assert match(Command(wrong, stderr=git_stash_err), None)
@pytest.mark.parametrize('wrong,fixed', [
('git stash opp', 'git stash pop'),
('git stash Some message', 'git stash save Some message'),
('git stash saev Some message', 'git stash save Some message')])
def test_get_new_command(wrong, fixed):
assert get_new_command(Command(wrong, stderr=git_stash_err), None) == fixed