mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-04 19:26:52 +00:00
Forbid files with a UTF-8 BOM
This commit is contained in:
parent
97b88d9610
commit
fe9c404019
5 changed files with 49 additions and 0 deletions
16
tests/check_byte_order_marker_test.py
Normal file
16
tests/check_byte_order_marker_test.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from pre_commit_hooks import check_byte_order_marker
|
||||
|
||||
|
||||
def test_failure(tmpdir):
|
||||
f = tmpdir.join('f.txt')
|
||||
f.write_text('ohai', encoding='utf-8-sig')
|
||||
assert check_byte_order_marker.main((f.strpath,)) == 1
|
||||
|
||||
|
||||
def test_success(tmpdir):
|
||||
f = tmpdir.join('f.txt')
|
||||
f.write_text('ohai', encoding='utf-8')
|
||||
assert check_byte_order_marker.main((f.strpath,)) == 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue