From bd953b6b2977eb9d9afb92208f117dd8845a3088 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 7 Mar 2020 00:18:40 +0530 Subject: coredata: Passing an option is supposed to set it, not flip the default With the current logic passing `--debug` will actually be parsed as `-Ddebug=false`, which is absolutely not what is expected. There is no case in which the presence of a boolean option in `--foo` form will mean 'I want feature foo disabled', regardless of the *default* value of that option. Also includes a test. Closes https://github.com/mesonbuild/meson/issues/4686 --- run_unittests.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'run_unittests.py') diff --git a/run_unittests.py b/run_unittests.py index 5b25b6c..41e8ad4 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3842,6 +3842,14 @@ recommended as it is not supported on some platforms''') self.assertEqual(opts['debug'], True) self.assertEqual(opts['optimization'], '2') self.assertEqual(opts['buildtype'], 'debugoptimized') + # Setting both buildtype and debug on the command-line should work + # Also test that --debug is parsed as -Ddebug=true + self.new_builddir() + self.init(testdir, extra_args=['-Dbuildtype=debugoptimized', '--debug']) + opts = self.get_opts_as_dict() + self.assertEqual(opts['debug'], True) + self.assertEqual(opts['optimization'], '2') + self.assertEqual(opts['buildtype'], 'debugoptimized') @skipIfNoPkgconfig @unittest.skipIf(is_windows(), 'Help needed with fixing this test on windows') -- cgit v1.1