aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-03-04 02:00:49 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2020-03-05 00:37:57 +0530
commit74769617907f571d2099001d3a7443e23b4f6cda (patch)
tree4e96557744f3f451d352cb4532d12e51dc5452cb
parent1cfa2c3acab25c78264a62309d29cba255feac87 (diff)
downloadmeson-74769617907f571d2099001d3a7443e23b4f6cda.zip
meson-74769617907f571d2099001d3a7443e23b4f6cda.tar.gz
meson-74769617907f571d2099001d3a7443e23b4f6cda.tar.bz2
unit tests: Test the buildtype table in the docs
-rwxr-xr-xrun_unittests.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 0249183..658da37 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1328,6 +1328,29 @@ class DataTests(unittest.TestCase):
*mesonbuild.coredata.builtin_options_per_machine.keys()
]))
+ # Check that `buildtype` table inside `Core options` matches how
+ # setting of builtin options behaves
+ #
+ # Find all tables inside this subsection
+ tables = re.finditer(r"^\| (\w+) .* \|\n\| *[-|\s]+ *\|$", subcontent2, re.MULTILINE)
+ # Get the table we want using the header of the first column
+ table = self._get_section_content('buildtype', tables, subcontent2)
+ # Get table row data
+ rows = re.finditer(r"^\|(?: (\w+)\s+\| (\w+)\s+\| (\w+) .* | *-+ *)\|", table, re.MULTILINE)
+ env = get_fake_env()
+ for m in rows:
+ buildtype, debug, opt = m.groups()
+ if debug == 'true':
+ debug = True
+ elif debug == 'false':
+ debug = False
+ else:
+ raise RuntimeError('Invalid debug value {!r} in row:\n{}'.format(debug, m.group()))
+ env.coredata.set_builtin_option('buildtype', buildtype)
+ self.assertEqual(env.coredata.builtins['buildtype'].value, buildtype)
+ self.assertEqual(env.coredata.builtins['optimization'].value, opt)
+ self.assertEqual(env.coredata.builtins['debug'].value, debug)
+
def test_cpu_families_documented(self):
with open("docs/markdown/Reference-tables.md", encoding='utf-8') as f:
md = f.read()