blob: 909a39bbeffda6c42c41b246ca8d9b74bab17d08 [file] [log] [blame]
Anthony Sottile8f615292022-01-15 19:24:05 -05001from __future__ import annotations
2
Anthony Sottilefe9c4042016-03-18 10:59:31 -07003from pre_commit_hooks import check_byte_order_marker
4
5
6def test_failure(tmpdir):
7 f = tmpdir.join('f.txt')
8 f.write_text('ohai', encoding='utf-8-sig')
Max Rozentsveygf35bfed2020-05-20 12:07:45 -04009 assert check_byte_order_marker.main((str(f),)) == 1
Anthony Sottilefe9c4042016-03-18 10:59:31 -070010
11
12def test_success(tmpdir):
13 f = tmpdir.join('f.txt')
14 f.write_text('ohai', encoding='utf-8')
Max Rozentsveygf35bfed2020-05-20 12:07:45 -040015 assert check_byte_order_marker.main((str(f),)) == 0