mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-03 02:56:52 +00:00
feat: add a simple HTML check pre-commit hook
This commit is contained in:
parent
ae7cee538b
commit
1d83507cf7
10 changed files with 118 additions and 0 deletions
20
tests/check_html_test.py
Normal file
20
tests/check_html_test.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from pre_commit_hooks.check_html import main
|
||||
from testing.util import get_resource_path
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('filename', 'expected_retval'), (
|
||||
('bad_html_not_closed.html', 1),
|
||||
('bad_html_too_many_close.html', 1),
|
||||
('bad_html_wrong_close.html', 1),
|
||||
('ok_html_fragment.html', 0),
|
||||
('ok_html_page.html', 0),
|
||||
),
|
||||
)
|
||||
def test_main(filename, expected_retval):
|
||||
ret = main([get_resource_path(filename)])
|
||||
assert ret == expected_retval
|
||||
Loading…
Add table
Add a link
Reference in a new issue