Added a unit test for built-in options docs
@@ -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()
