Add Python executables to parse go testify output
This commit is contained in:
parent
afd00343f4
commit
3e48836ab7
8
dotfiles/lib/python/parse_go_testify_for_emacs.py
Executable file
8
dotfiles/lib/python/parse_go_testify_for_emacs.py
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import parse_go_testify_not_equal
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
actual, expected = parse_go_testify_not_equal.get_strings(sys.stdin.read())
|
||||||
|
print json.dumps({"actual": actual, "expected": expected})
|
29
dotfiles/lib/python/parse_go_testify_not_equal.py
Executable file
29
dotfiles/lib/python/parse_go_testify_not_equal.py
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
from subprocess import call
|
||||||
|
|
||||||
|
|
||||||
|
expected_re = re.compile("Error:\\s*Not equal:\\s*(.*?)\\s*\\(expected\\)")
|
||||||
|
actual_re = re.compile("!=\\s*(.*?)\\s*\(actual\)")
|
||||||
|
|
||||||
|
|
||||||
|
def get_strings(incoming):
|
||||||
|
expected_match = expected_re.search(incoming)
|
||||||
|
actual_match = actual_re.search(incoming)
|
||||||
|
return (eval(expected_match.group(1)), eval(actual_match.group(1)))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
stdin = sys.stdin.read()
|
||||||
|
_, expected_filename = tempfile.mkstemp()
|
||||||
|
_, actual_filename = tempfile.mkstemp()
|
||||||
|
expected_text, actual_text = get_strings(stdin)
|
||||||
|
with open(expected_filename, 'w') as expected_file:
|
||||||
|
expected_file.write(expected_text)
|
||||||
|
|
||||||
|
with open(actual_filename, 'w') as actual_file:
|
||||||
|
actual_file.write(actual_text)
|
||||||
|
|
||||||
|
call(["icdiff", expected_filename, actual_filename, "--show-all-spaces"])
|
Loading…
Reference in New Issue
Block a user