Skip to content

Commit 5e6af8a

Browse files
committed
cr_checker: tests: add test case for file exclusion
1 parent 3e0951b commit 5e6af8a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

cr_checker/tests/test_cr_checker.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,24 @@ def test_process_files_inserts_missing_header(prepare_test_no_header):
178178
assert test_file.read_text(encoding="utf-8").startswith(expected_header)
179179

180180

181+
def test_process_files_skips_exclusion_with_missing_header(prepare_test_no_header):
182+
cr_checker = load_cr_checker_module()
183+
test_file, extension, header_template, tmp_path = prepare_test_no_header
184+
185+
results = cr_checker.process_files(
186+
[test_file],
187+
{extension: header_template},
188+
False,
189+
[str(test_file)],
190+
use_mmap=False,
191+
encoding="utf-8",
192+
offset=0,
193+
remove_offset=0,
194+
)
195+
196+
assert results["no_copyright"] == 0
197+
198+
181199
# test that process_files function validates a license header after the shebang line
182200
def test_process_files_accepts_header_after_shebang(tmp_path):
183201
cr_checker = load_cr_checker_module()

0 commit comments

Comments
 (0)