aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-02-01 10:44:17 +0100
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-02-01 11:49:52 +0000
commitda7b9df16c696979b0f3860cbde1692e2ba5e0cc (patch)
tree606347aae445d57ec75d5ff02c77208298b5a9ea
parent79c087bad2f31f66da24169136c77b744ce4a453 (diff)
downloadmeson-da7b9df16c696979b0f3860cbde1692e2ba5e0cc.zip
meson-da7b9df16c696979b0f3860cbde1692e2ba5e0cc.tar.gz
meson-da7b9df16c696979b0f3860cbde1692e2ba5e0cc.tar.bz2
Ensure that func dicts provide the same set of functions
-rw-r--r--mesonbuild/ast/interpreter.py10
-rwxr-xr-xrun_unittests.py11
2 files changed, 21 insertions, 0 deletions
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py
index 2071432..68c017a 100644
--- a/mesonbuild/ast/interpreter.py
+++ b/mesonbuild/ast/interpreter.py
@@ -89,6 +89,16 @@ class AstInterpreter(interpreterbase.InterpreterBase):
'set_variable': self.func_do_nothing,
'get_variable': self.func_do_nothing,
'is_variable': self.func_do_nothing,
+ 'disabler': self.func_do_nothing,
+ 'gettext': self.func_do_nothing,
+ 'jar': self.func_do_nothing,
+ 'warning': self.func_do_nothing,
+ 'shared_module': self.func_do_nothing,
+ 'option': self.func_do_nothing,
+ 'both_libraries': self.func_do_nothing,
+ 'add_test_setup': self.func_do_nothing,
+ 'find_library': self.func_do_nothing,
+ 'subdir_done': self.func_do_nothing,
})
def func_do_nothing(self, node, args, kwargs):
diff --git a/run_unittests.py b/run_unittests.py
index 72ab062..bc827bc 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -42,6 +42,7 @@ import mesonbuild.mesonlib
import mesonbuild.coredata
import mesonbuild.modules.gnome
from mesonbuild.interpreter import Interpreter, ObjectHolder
+from mesonbuild.ast import AstInterpreter
from mesonbuild.mesonlib import (
is_windows, is_osx, is_cygwin, is_dragonflybsd, is_openbsd, is_haiku,
windows_proof_rmtree, python_command, version_compare,
@@ -1053,6 +1054,16 @@ 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())))
+ 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).
+ '''
+ env = get_fake_env()
+ interp = Interpreter(FakeBuild(env), mock=True)
+ astint = AstInterpreter('.', '')
+ self.assertEqual(set(interp.funcs.keys()), set(astint.funcs.keys()))
+
class BasePlatformTests(unittest.TestCase):
def setUp(self):