diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index f3ea766ae..a68a0f9d2 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1505,7 +1505,7 @@ class DCompiler(Compiler): def get_soname_args(self, shlib_name, path, soversion): return [] - def get_unittest_flag(self): + def get_unittest_args(self): return ['-unittest'] def get_buildtype_linker_args(self, buildtype): @@ -1587,7 +1587,7 @@ class GnuDCompiler(DCompiler): def build_rpath_args(self, build_dir, rpath_paths, install_rpath): return build_unix_rpath_args(build_dir, rpath_paths, install_rpath) - def get_unittest_flag(self): + def get_unittest_args(self): return ['-funittest'] class LLVMDCompiler(DCompiler): diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 763eb7da9..f9841bd6d 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -597,7 +597,7 @@ class CompilerHolder(InterpreterObject): 'find_library': self.find_library_method, 'has_argument' : self.has_argument_method, 'first_supported_argument' : self.first_supported_argument_method, - 'get_unittest_flag' : self.get_unittest_flag_method, + 'unittest_args' : self.unittest_args_method, }) def version_method(self, args, kwargs): @@ -651,11 +651,11 @@ class CompilerHolder(InterpreterObject): def get_id_method(self, args, kwargs): return self.compiler.get_id() - def get_unittest_flag_method(self, args, kwargs): + def unittest_args_method(self, args, kwargs): # At time, only D compilers have this feature. - if not getattr(self.compiler, "get_unittest_flag", None): - return '' - return self.compiler.get_unittest_flag() + if not hasattr(self.compiler, 'get_unittest_args'): + raise InterpreterException('This {} compiler has no unittest arguments.'.format(self.compiler.language)) + return self.compiler.get_unittest_args() def has_member_method(self, args, kwargs): if len(args) != 2: