1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 14:48:49 +00:00

added test and readme

This commit is contained in:
xce35g6 2019-02-06 17:04:34 +01:00
parent 4b67eba2ea
commit a633fb5366
2 changed files with 26 additions and 0 deletions

View File

@ -209,6 +209,7 @@ following rules are enabled by default:
* `git_fix_stash` – fixes `git stash` commands (misspelled subcommand and missing `save`);
* `git_flag_after_filename` – fixes `fatal: bad flag '...' after filename`
* `git_help_aliased` &ndash; fixes `git help <alias>` commands replacing <alias> with the aliased command;
* `git_log` &ndash; replaces `git lock` command with `git log`;
* `git_merge` &ndash; adds remote to branch names;
* `git_merge_unrelated` &ndash; adds `--allow-unrelated-histories` when required
* `git_not_command` &ndash; fixes wrong git commands like `git brnch`;

View File

@ -0,0 +1,25 @@
import pytest
from thefuck.rules.git_log import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('script, output', [
('git lock', 'git: \'lock\' is not a git command.'),
('git lock --help', 'git: \'lock\' is not a git command.')])
def test_match(output, script):
assert match(Command(script, output))
@pytest.mark.parametrize('script', [
'git branch foo',
'git checkout feature/test_commit',
'git push'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, output', [
('git lock', 'git log'),
('git lock --help', 'git log --help')])
def test_get_new_command(script, output):
assert get_new_command(Command(script, '')) == output