mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Rename option to and improve output
This commit is contained in:
parent
19075371fa
commit
55c74c10d9
2 changed files with 31 additions and 16 deletions
|
|
@ -40,22 +40,29 @@ def test_ignore_case(some_files, cap_out):
|
|||
assert out == 'f2:1:[INFO] hi\n'
|
||||
|
||||
|
||||
def test_null_data(some_files, cap_out):
|
||||
ret = pygrep.main(('--null-data', r'foo\nbar', 'f1', 'f2', 'f3'))
|
||||
def test_multiline(some_files, cap_out):
|
||||
ret = pygrep.main(('--multiline', r'foo\nbar', 'f1', 'f2', 'f3'))
|
||||
out = cap_out.get()
|
||||
assert ret == 1
|
||||
assert out == 'f1:0-7:foo\nbar\n'
|
||||
assert out == 'f1:1:foo\nbar\n'
|
||||
|
||||
|
||||
def test_null_data_dotall_flag_is_enabled(some_files, cap_out):
|
||||
ret = pygrep.main(('--null-data', r'o.*bar', 'f1', 'f2', 'f3'))
|
||||
def test_multiline_line_number(some_files, cap_out):
|
||||
ret = pygrep.main(('--multiline', r'ar', 'f1', 'f2', 'f3'))
|
||||
out = cap_out.get()
|
||||
assert ret == 1
|
||||
assert out == 'f1:1-7:oo\nbar\n'
|
||||
assert out == 'f1:2:bar\n'
|
||||
|
||||
|
||||
def test_null_data_multiline_flag_is_enabled(some_files, cap_out):
|
||||
ret = pygrep.main(('--null-data', r'foo$.*bar', 'f1', 'f2', 'f3'))
|
||||
def test_multiline_dotall_flag_is_enabled(some_files, cap_out):
|
||||
ret = pygrep.main(('--multiline', r'o.*bar', 'f1', 'f2', 'f3'))
|
||||
out = cap_out.get()
|
||||
assert ret == 1
|
||||
assert out == 'f1:0-7:foo\nbar\n'
|
||||
assert out == 'f1:1:foo\nbar\n'
|
||||
|
||||
|
||||
def test_multiline_multiline_flag_is_enabled(some_files, cap_out):
|
||||
ret = pygrep.main(('--multiline', r'foo$.*bar', 'f1', 'f2', 'f3'))
|
||||
out = cap_out.get()
|
||||
assert ret == 1
|
||||
assert out == 'f1:1:foo\nbar\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue