mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-04 19:26:52 +00:00
Print filenames in the diff
This commit is contained in:
parent
7d878b55ff
commit
ec6c39ee62
2 changed files with 20 additions and 9 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
|
|
@ -110,9 +111,13 @@ def test_badfile_main():
|
|||
def test_diffing_output(capsys):
|
||||
resource_path = get_resource_path('not_pretty_formatted_json.json')
|
||||
expected_retval = 1
|
||||
a = os.path.join('a', resource_path)
|
||||
b = os.path.join('b', resource_path)
|
||||
expected_out = '''\
|
||||
--- \n+++ \n@@ -1,6 +1,9 @@
|
||||
{
|
||||
--- {}
|
||||
+++ {}
|
||||
@@ -1,6 +1,9 @@
|
||||
{{
|
||||
- "foo":
|
||||
- "bar",
|
||||
- "alist": [2, 34, 234],
|
||||
|
|
@ -124,9 +129,9 @@ def test_diffing_output(capsys):
|
|||
+ ],
|
||||
+ "blah": null,
|
||||
+ "foo": "bar"
|
||||
}
|
||||
}}
|
||||
|
||||
'''
|
||||
'''.format(a, b)
|
||||
expected_err = 'File {} is not pretty-formatted\n'.format(resource_path)
|
||||
|
||||
actual_retval = main([resource_path])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue