Add new byte-order-marker checker/fixer

This commit is contained in:
Jeremiah Gowdy 2020-10-04 18:45:54 -07:00 committed by Anthony Sottile
parent 5bd9e74adf
commit d18bd5b75f
5 changed files with 56 additions and 5 deletions

View file

@ -0,0 +1,13 @@
from pre_commit_hooks import fix_byte_order_marker
def test_failure(tmpdir):
f = tmpdir.join('f.txt')
f.write_text('ohai', encoding='utf-8-sig')
assert fix_byte_order_marker.main((str(f),)) == 1
def test_success(tmpdir):
f = tmpdir.join('f.txt')
f.write_text('ohai', encoding='utf-8')
assert fix_byte_order_marker.main((str(f),)) == 0