aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-03-05 22:20:45 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-03-06 14:02:22 +0200
commitfa1401bec1ce74f120bae8747c02db51b287d950 (patch)
treeb8cf610e5a0c7298cfcaf5713ef940921bf31d68
parent9e18e4c703ef85450ac6a16ae3cc9d785d3e1691 (diff)
downloadmeson-fa1401bec1ce74f120bae8747c02db51b287d950.zip
meson-fa1401bec1ce74f120bae8747c02db51b287d950.tar.gz
meson-fa1401bec1ce74f120bae8747c02db51b287d950.tar.bz2
Verify that snippets conform to expected format.
-rwxr-xr-xrun_unittests.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 8f69077..35c5eec 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -25,7 +25,7 @@ import unittest
from unittest import mock
from configparser import ConfigParser
from glob import glob
-from pathlib import PurePath
+from pathlib import (PurePath, Path)
import mesonbuild.mlog
import mesonbuild.compilers
@@ -429,6 +429,20 @@ class InternalTests(unittest.TestCase):
kwargs = {'sources': [1, 2, 3], 'pch_sources': [4, 5, 6]}
self.assertEqual([[1, 2, 3], [4, 5, 6]], extract(kwargs, 'sources', 'pch_sources'))
+ def test_snippets(self):
+ hashcounter = re.compile('^ *(#)+')
+ snippet_dir = Path('docs/markdown/snippets')
+ self.assertTrue(snippet_dir.is_dir())
+ for f in snippet_dir.glob('*'):
+ self.assertTrue(f.is_file())
+ if f.suffix == '.md':
+ for line in f.open():
+ m = re.match(hashcounter, line)
+ if m:
+ self.assertEqual(len(m.group(0)), 2, 'All headings in snippets must have two hash symbols: ' + f.name)
+ else:
+ if f.name != 'add_release_note_snippets_here':
+ self.assertTrue(False, 'A file without .md suffix in snippets dir: ' + f.name)
class BasePlatformTests(unittest.TestCase):
def setUp(self):