2022-01-16 08:24:05 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2015-01-18 02:21:44 +08:00
|
|
|
import pytest
|
|
|
|
|
2019-02-01 11:19:10 +08:00
|
|
|
from pre_commit_hooks.check_xml import main
|
2015-01-18 02:21:44 +08:00
|
|
|
from testing.util import get_resource_path
|
|
|
|
|
|
|
|
|
2017-07-16 03:56:51 +08:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
('filename', 'expected_retval'), (
|
|
|
|
('bad_xml.notxml', 1),
|
|
|
|
('ok_xml.xml', 0),
|
|
|
|
),
|
|
|
|
)
|
2019-02-01 11:19:10 +08:00
|
|
|
def test_main(filename, expected_retval):
|
|
|
|
ret = main([get_resource_path(filename)])
|
2015-01-18 02:21:44 +08:00
|
|
|
assert ret == expected_retval
|