1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-18 08:23:51 +03:00

test/bad_chars: ensure our tests could fail

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Douglas Bagnall
2021-11-17 10:23:02 +13:00
committed by Ralph Boehme
parent fccb105e07
commit c3194d0d65
2 changed files with 36 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ IGNORED_FILES = {
'source3/selftest/ktest-krb5_ccache-2',
'source3/selftest/ktest-krb5_ccache-3',
'third_party/pep8/testsuite/latin-1.py',
'testdata/source-chars-bad.c',
}
IGNORED_EXTENSIONS = {
@@ -205,6 +206,18 @@ class CharacterTests(TestCase):
if is_bad_char(c):
self.fail(f"{name} has potentially bad format characters!")
def test_unexpected_format_chars_do_fail(self):
"""Test the test"""
for name, n_bad in [
('testdata/source-chars-bad.c', 3)
]:
fullname = os.path.join(ROOT, name)
with open(fullname) as f:
s = f.read()
chars = set(s)
bad_chars = [c for c in chars if is_bad_char(c)]
self.assertEqual(len(bad_chars), n_bad)
def check_file_text():
"""If called directly as a script, count the found characters."""