1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-20 09:39:01 +00:00

Rename variable

This commit is contained in:
Divya Jain 2020-05-21 15:54:40 +05:30
parent b4d930810a
commit 7bc8a417e4

View File

@ -6,50 +6,50 @@ from collections import namedtuple
from thefuck.rules.fix_file import match, get_new_command from thefuck.rules.fix_file import match, get_new_command
from thefuck.types import Command from thefuck.types import Command
FileFixTest = namedtuple('FileFixTest', ['script', 'file', 'line', 'col', 'output']) FixFileTest = namedtuple('FixFileTest', ['script', 'file', 'line', 'col', 'output'])
tests = ( tests = (
FileFixTest('gcc a.c', 'a.c', 3, 1, """ FixFileTest('gcc a.c', 'a.c', 3, 1, """
a.c: In function 'main': a.c: In function 'main':
a.c:3:1: error: expected expression before '}' token a.c:3:1: error: expected expression before '}' token
} }
^ ^
"""), """),
FileFixTest('clang a.c', 'a.c', 3, 1, """ FixFileTest('clang a.c', 'a.c', 3, 1, """
a.c:3:1: error: expected expression a.c:3:1: error: expected expression
} }
^ ^
"""), """),
FileFixTest('perl a.pl', 'a.pl', 3, None, """ FixFileTest('perl a.pl', 'a.pl', 3, None, """
syntax error at a.pl line 3, at EOF syntax error at a.pl line 3, at EOF
Execution of a.pl aborted due to compilation errors. Execution of a.pl aborted due to compilation errors.
"""), """),
FileFixTest('perl a.pl', 'a.pl', 2, None, """ FixFileTest('perl a.pl', 'a.pl', 2, None, """
Search pattern not terminated at a.pl line 2. Search pattern not terminated at a.pl line 2.
"""), """),
FileFixTest('sh a.sh', 'a.sh', 2, None, """ FixFileTest('sh a.sh', 'a.sh', 2, None, """
a.sh: line 2: foo: command not found a.sh: line 2: foo: command not found
"""), """),
FileFixTest('zsh a.sh', 'a.sh', 2, None, """ FixFileTest('zsh a.sh', 'a.sh', 2, None, """
a.sh:2: command not found: foo a.sh:2: command not found: foo
"""), """),
FileFixTest('bash a.sh', 'a.sh', 2, None, """ FixFileTest('bash a.sh', 'a.sh', 2, None, """
a.sh: line 2: foo: command not found a.sh: line 2: foo: command not found
"""), """),
FileFixTest('rustc a.rs', 'a.rs', 2, 5, """ FixFileTest('rustc a.rs', 'a.rs', 2, 5, """
a.rs:2:5: 2:6 error: unexpected token: `+` a.rs:2:5: 2:6 error: unexpected token: `+`
a.rs:2 + a.rs:2 +
^ ^
"""), """),
FileFixTest('cargo build', 'src/lib.rs', 3, 5, """ FixFileTest('cargo build', 'src/lib.rs', 3, 5, """
Compiling test v0.1.0 (file:///tmp/fix-error/test) Compiling test v0.1.0 (file:///tmp/fix-error/test)
src/lib.rs:3:5: 3:6 error: unexpected token: `+` src/lib.rs:3:5: 3:6 error: unexpected token: `+`
src/lib.rs:3 + src/lib.rs:3 +
@ -59,14 +59,14 @@ Could not compile `test`.
To learn more, run the command again with --verbose. To learn more, run the command again with --verbose.
"""), """),
FileFixTest('python a.py', 'a.py', 2, None, """ FixFileTest('python a.py', 'a.py', 2, None, """
File "a.py", line 2 File "a.py", line 2
+ +
^ ^
SyntaxError: invalid syntax SyntaxError: invalid syntax
"""), """),
FileFixTest('python a.py', 'a.py', 8, None, """ FixFileTest('python a.py', 'a.py', 8, None, """
Traceback (most recent call last): Traceback (most recent call last):
File "a.py", line 8, in <module> File "a.py", line 8, in <module>
match("foo") match("foo")
@ -79,7 +79,7 @@ Traceback (most recent call last):
TypeError: first argument must be string or compiled pattern TypeError: first argument must be string or compiled pattern
"""), """),
FileFixTest(u'python café.py', u'café.py', 8, None, u""" FixFileTest(u'python café.py', u'café.py', 8, None, u"""
Traceback (most recent call last): Traceback (most recent call last):
File "café.py", line 8, in <module> File "café.py", line 8, in <module>
match("foo") match("foo")
@ -92,48 +92,48 @@ Traceback (most recent call last):
TypeError: first argument must be string or compiled pattern TypeError: first argument must be string or compiled pattern
"""), """),
FileFixTest('ruby a.rb', 'a.rb', 3, None, """ FixFileTest('ruby a.rb', 'a.rb', 3, None, """
a.rb:3: syntax error, unexpected keyword_end a.rb:3: syntax error, unexpected keyword_end
"""), """),
FileFixTest('lua a.lua', 'a.lua', 2, None, """ FixFileTest('lua a.lua', 'a.lua', 2, None, """
lua: a.lua:2: unexpected symbol near '+' lua: a.lua:2: unexpected symbol near '+'
"""), """),
FileFixTest('fish a.sh', '/tmp/fix-error/a.sh', 2, None, """ FixFileTest('fish a.sh', '/tmp/fix-error/a.sh', 2, None, """
fish: Unknown command 'foo' fish: Unknown command 'foo'
/tmp/fix-error/a.sh (line 2): foo /tmp/fix-error/a.sh (line 2): foo
^ ^
"""), """),
FileFixTest('./a', './a', 2, None, """ FixFileTest('./a', './a', 2, None, """
awk: ./a:2: BEGIN { print "Hello, world!" + } awk: ./a:2: BEGIN { print "Hello, world!" + }
awk: ./a:2: ^ syntax error awk: ./a:2: ^ syntax error
"""), """),
FileFixTest('llc a.ll', 'a.ll', 1, 2, """ FixFileTest('llc a.ll', 'a.ll', 1, 2, """
llc: a.ll:1:2: error: expected top-level entity llc: a.ll:1:2: error: expected top-level entity
+ +
^ ^
"""), """),
FileFixTest('go build a.go', 'a.go', 1, 2, """ FixFileTest('go build a.go', 'a.go', 1, 2, """
can't load package: can't load package:
a.go:1:2: expected 'package', found '+' a.go:1:2: expected 'package', found '+'
"""), """),
FileFixTest('make', 'Makefile', 2, None, """ FixFileTest('make', 'Makefile', 2, None, """
bidule bidule
make: bidule: Command not found make: bidule: Command not found
Makefile:2: recipe for target 'target' failed Makefile:2: recipe for target 'target' failed
make: *** [target] Error 127 make: *** [target] Error 127
"""), """),
FileFixTest('git st', '/home/martin/.config/git/config', 1, None, """ FixFileTest('git st', '/home/martin/.config/git/config', 1, None, """
fatal: bad config file line 1 in /home/martin/.config/git/config fatal: bad config file line 1 in /home/martin/.config/git/config
"""), """),
FileFixTest('node fuck.js asdf qwer', '/Users/pablo/Workspace/barebones/fuck.js', '2', 5, """ FixFileTest('node fuck.js asdf qwer', '/Users/pablo/Workspace/barebones/fuck.js', '2', 5, """
/Users/pablo/Workspace/barebones/fuck.js:2 /Users/pablo/Workspace/barebones/fuck.js:2
conole.log(arg); // this should read console.log(arg); conole.log(arg); // this should read console.log(arg);
^ ^
@ -150,14 +150,14 @@ ReferenceError: conole is not defined
at node.js:814:3 at node.js:814:3
"""), """),
FileFixTest('pep8', './tests/rules/test_systemctl.py', 17, 80, """ FixFileTest('pep8', './tests/rules/test_systemctl.py', 17, 80, """
./tests/rules/test_systemctl.py:17:80: E501 line too long (93 > 79 characters) ./tests/rules/test_systemctl.py:17:80: E501 line too long (93 > 79 characters)
./tests/rules/test_systemctl.py:18:80: E501 line too long (103 > 79 characters) ./tests/rules/test_systemctl.py:18:80: E501 line too long (103 > 79 characters)
./tests/rules/test_whois.py:20:80: E501 line too long (89 > 79 characters) ./tests/rules/test_whois.py:20:80: E501 line too long (89 > 79 characters)
./tests/rules/test_whois.py:22:80: E501 line too long (83 > 79 characters) ./tests/rules/test_whois.py:22:80: E501 line too long (83 > 79 characters)
"""), """),
FileFixTest('py.test', '/home/thefuck/tests/rules/test_fix_file.py', 218, None, """ FixFileTest('py.test', '/home/thefuck/tests/rules/test_fix_file.py', 218, None, """
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7fdb76a25b38> monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7fdb76a25b38>
test = ('fish a.sh', '/tmp/fix-error/a.sh', 2, None, '', "\\nfish: Unknown command 'foo'\\n/tmp/fix-error/a.sh (line 2): foo\\n ^\\n") test = ('fish a.sh', '/tmp/fix-error/a.sh', 2, None, '', "\\nfish: Unknown command 'foo'\\n/tmp/fix-error/a.sh (line 2): foo\\n ^\\n")