mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 03:26:53 +00:00
Add new byte-order-marker checker/fixer
This commit is contained in:
parent
5bd9e74adf
commit
d18bd5b75f
5 changed files with 56 additions and 5 deletions
13
tests/fix_byte_order_marker_test.py
Normal file
13
tests/fix_byte_order_marker_test.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue