diff options
-rwxr-xr-x | run_unittests.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 6642511..99e3c49 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1008,6 +1008,42 @@ class DataTests(unittest.TestCase): self.assertIn(opt, md) self.assertNotIn('b_unknown', md) + def test_builtin_options_documented(self): + ''' + Test that universal options and base options are documented in + Builtin-Options.md. + ''' + md = None + with open('docs/markdown/Builtin-options.md') as f: + md = f.read() + self.assertIsNotNone(md) + + found_entries = set() + sections = list(re.finditer(r"^## (.+)$", md, re.MULTILINE)) + [None] + + for s1, s2 in zip(sections[:], sections[1:]): + if s1.group(1) == "Universal options": + # Extract the content for this section + end = s2.start() if s2 is not None else len(md) + content = md[s1.end():end] + subsections = list(re.finditer(r"^### (.+)$", content, re.MULTILINE)) + [None] + + for sub1, sub2 in zip(subsections[:], subsections[1:]): + if sub1.group(1) == "Directories" or sub1.group(1) == "Core options": + # Extract the content for this subsection + sub_end = sub2.start() if sub2 is not None else len(content) + subcontent = content[sub1.end():sub_end] + # Find the list entries + arches = [m.group(1) for m in re.finditer(r"^\| (\w+) .* \|", subcontent, re.MULTILINE)] + # Drop the header + arches = set(arches[1:]) + + self.assertEqual(len(found_entries & arches), 0) + found_entries |= arches + break + + self.assertEqual(found_entries, set(mesonbuild.coredata.builtin_options.keys())) + def test_cpu_families_documented(self): with open("docs/markdown/Reference-tables.md") as f: md = f.read() |