diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-04-26 22:18:46 -0400 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.com> | 2018-04-27 11:09:14 -0400 |
commit | 570c108635ca4b895330a6794061014c278886f8 (patch) | |
tree | 74a339e66c5dbc24abec00fac9983b8073dd35f4 /run_unittests.py | |
parent | cb5ad2f2114519e4009f7ee6fcab3ad40d971de2 (diff) | |
download | meson-570c108635ca4b895330a6794061014c278886f8.zip meson-570c108635ca4b895330a6794061014c278886f8.tar.gz meson-570c108635ca4b895330a6794061014c278886f8.tar.bz2 |
Fix --warnlevel being renamed to --warning-level in latest release
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index f06c9a0..fa652a9 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2073,6 +2073,44 @@ recommended as it can lead to undefined behaviour on some platforms''') self._test_same_option_twice_configure( 'one', ['-Done=foo', '-Done=bar']) + def test_command_line(self): + testdir = os.path.join(self.unit_test_dir, '30 command line') + + # Verify default values when passing no args + self.init(testdir) + obj = mesonbuild.coredata.load(self.builddir) + self.assertEqual(obj.builtins['warning_level'].value, '1') + self.wipe() + + # warning_level is special, it's --warnlevel instead of --warning-level + # for historical reasons + self.init(testdir, extra_args=['--warnlevel=2']) + obj = mesonbuild.coredata.load(self.builddir) + self.assertEqual(obj.builtins['warning_level'].value, '2') + self.setconf('--warnlevel=3') + obj = mesonbuild.coredata.load(self.builddir) + self.assertEqual(obj.builtins['warning_level'].value, '3') + self.wipe() + + # But when using -D syntax, it should be 'warning_level' + self.init(testdir, extra_args=['-Dwarning_level=2']) + obj = mesonbuild.coredata.load(self.builddir) + self.assertEqual(obj.builtins['warning_level'].value, '2') + self.setconf('-Dwarning_level=3') + obj = mesonbuild.coredata.load(self.builddir) + self.assertEqual(obj.builtins['warning_level'].value, '3') + self.wipe() + + # Mixing --option and -Doption is forbidden + with self.assertRaises(subprocess.CalledProcessError) as e: + self.init(testdir, extra_args=['--warnlevel=1', '-Dwarning_level=3']) + self.assertNotEqual(0, e.returncode) + self.assertIn('passed as both', e.stderr) + with self.assertRaises(subprocess.CalledProcessError) as e: + self.setconf('--warnlevel=1', '-Dwarning_level=3') + self.assertNotEqual(0, e.returncode) + self.assertIn('passed as both', e.stderr) + self.wipe() class FailureTests(BasePlatformTests): |