aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-02-14 10:12:38 -0500
committerXavier Claessens <xclaesse@gmail.com>2023-03-01 20:13:34 -0500
commitf0dc61a76403d3ad26cbfa8e3922fa84343ba7d4 (patch)
tree7479c1af389b43a785c90a3a43e1574ff75d1205 /unittests
parenta952b01a0885da9cc89b637d78ee649aea437a95 (diff)
downloadmeson-f0dc61a76403d3ad26cbfa8e3922fa84343ba7d4.zip
meson-f0dc61a76403d3ad26cbfa8e3922fa84343ba7d4.tar.gz
meson-f0dc61a76403d3ad26cbfa8e3922fa84343ba7d4.tar.bz2
interpreter: Add testcase..endtestcase clause support
This is currently only enabled when running unit tests to facilitate writing failing unit tests. Fixes: #11394
Diffstat (limited to 'unittests')
-rw-r--r--unittests/datatests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/datatests.py b/unittests/datatests.py
index 9a46ec4..70fdcba 100644
--- a/unittests/datatests.py
+++ b/unittests/datatests.py
@@ -219,11 +219,14 @@ class DataTests(unittest.TestCase):
name = name.replace('_', '-')
self.assertIn(name, html)
+ @unittest.mock.patch.dict(os.environ)
def test_vim_syntax_highlighting(self):
'''
Ensure that vim syntax highlighting files were updated for new
functions in the global namespace in build files.
'''
+ # Disable unit test specific syntax
+ del os.environ['MESON_RUNNING_IN_PROJECT_TESTS']
env = get_fake_env()
interp = Interpreter(FakeBuild(env), mock=True)
with open('data/syntax-highlighting/vim/syntax/meson.vim', encoding='utf-8') as f:
@@ -231,11 +234,14 @@ class DataTests(unittest.TestCase):
defined = set([a.strip() for a in res.group().split('\\')][1:])
self.assertEqual(defined, set(chain(interp.funcs.keys(), interp.builtin.keys())))
+ @unittest.mock.patch.dict(os.environ)
def test_all_functions_defined_in_ast_interpreter(self):
'''
Ensure that the all functions defined in the Interpreter are also defined
in the AstInterpreter (and vice versa).
'''
+ # Disable unit test specific syntax
+ del os.environ['MESON_RUNNING_IN_PROJECT_TESTS']
env = get_fake_env()
interp = Interpreter(FakeBuild(env), mock=True)
astint = AstInterpreter('.', '', '')