aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrun_unittests.py26
-rw-r--r--test cases/unit/30 mixed command line args/meson.build1
-rw-r--r--test cases/unit/30 mixed command line args/meson_options.txt10
3 files changed, 37 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 3f80f74..be48f11 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -2020,6 +2020,32 @@ recommended as it can lead to undefined behaviour on some platforms''')
self.builddir = exebuilddir
self.assertRebuiltTarget('app')
+ def test_conflicting_d_dash_option(self):
+ testdir = os.path.join(self.unit_test_dir, '30 mixed command line args')
+ with self.assertRaises(subprocess.CalledProcessError) as e:
+ self.init(testdir, extra_args=['-Dbindir=foo', '--bindir=bar'])
+ # Just to ensure that we caught the correct error
+ self.assertIn('passed as both', e.stderr)
+
+ def _test_same_option_twice(self, arg, args):
+ testdir = os.path.join(self.unit_test_dir, '30 mixed command line args')
+ self.init(testdir, extra_args=args)
+ opts = self.introspect('--buildoptions')
+ for item in opts:
+ if item['name'] == arg:
+ self.assertEqual(item['value'], 'bar')
+ return
+ raise Exception('Missing {} value?'.format(arg))
+
+ def test_same_dash_option_twice(self):
+ self._test_same_option_twice('bindir', ['--bindir=foo', '--bindir=bar'])
+
+ def test_same_d_option_twice(self):
+ self._test_same_option_twice('bindir', ['-Dbindir=foo', '-Dbindir=bar'])
+
+ def test_same_project_d_option_twice(self):
+ self._test_same_option_twice('one', ['-Done=foo', '-Done=bar'])
+
class FailureTests(BasePlatformTests):
'''
diff --git a/test cases/unit/30 mixed command line args/meson.build b/test cases/unit/30 mixed command line args/meson.build
new file mode 100644
index 0000000..af5cdc7
--- /dev/null
+++ b/test cases/unit/30 mixed command line args/meson.build
@@ -0,0 +1 @@
+project('Mixed command line arguments')
diff --git a/test cases/unit/30 mixed command line args/meson_options.txt b/test cases/unit/30 mixed command line args/meson_options.txt
new file mode 100644
index 0000000..5a4bc22
--- /dev/null
+++ b/test cases/unit/30 mixed command line args/meson_options.txt
@@ -0,0 +1,10 @@
+option(
+ 'one',
+ type : 'string',
+)
+option(
+ 'two',
+ type : 'combo',
+ choices : ['foo', 'bar'],
+ value : 'foo',
+)