Remove encoding dependence

This commit is contained in:
Thierry Deo 2018-03-07 09:24:56 +01:00
parent 3793bc32c0
commit 25c06e6525
2 changed files with 21 additions and 4 deletions

View file

@ -41,7 +41,21 @@ def test_ignore_case(some_files, cap_out):
def test_null_data(some_files, cap_out):
ret = pygrep.main(('--null-data', r'foo.*bar', 'f1', 'f2', 'f3'))
ret = pygrep.main(('--null-data', r'foo\nbar', 'f1', 'f2', 'f3'))
out = cap_out.get()
assert ret == 1
assert out == 'f1:foobar\n'
assert out == 'f1:0-7: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'))
out = cap_out.get()
assert ret == 1
assert out == 'f1:1-7:oo\nbar\n'
def test_null_data_multiline_flag_is_enabled(some_files, cap_out):
ret = pygrep.main(('--null-data', r'foo$.*bar', 'f1', 'f2', 'f3'))
out = cap_out.get()
assert ret == 1
assert out == 'f1:0-7:foo\nbar\n'