aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorTheQwertiest <qwertiest@mail.ru>2019-04-12 00:24:07 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2019-04-12 00:24:07 +0300
commit2499e2547656f244ba654db7208f5453d6b53eff (patch)
treece72fef8ea4c4d247c167a3a715a4a7b46597d79 /run_unittests.py
parenta2d222c383f569241006f826690f599c4f187849 (diff)
downloadmeson-2499e2547656f244ba654db7208f5453d6b53eff.zip
meson-2499e2547656f244ba654db7208f5453d6b53eff.tar.gz
meson-2499e2547656f244ba654db7208f5453d6b53eff.tar.bz2
Added a unit test for built-in options docs
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py36
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()