aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py48
1 files changed, 47 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 5b3b3e1..9bf712c 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1,4 +1,3 @@
-
#!/usr/bin/env python3
# Copyright 2016-2017 The Meson development team
@@ -1565,6 +1564,53 @@ int main(int argc, char **argv) {
cargs = ['-I' + incdir.as_posix()]
self.assertEqual(foo_dep.get_compile_args(), cargs)
+ def test_array_option_change(self):
+ def get_opt():
+ opts = self.introspect('--buildoptions')
+ for x in opts:
+ if x.get('name') == 'list':
+ return x
+ raise Exception(opts)
+
+ expected = {
+ 'name': 'list',
+ 'description': 'list',
+ 'type': 'stringarray',
+ 'value': ['foo', 'bar'],
+ }
+ tdir = os.path.join(self.unit_test_dir, '18 array option')
+ self.init(tdir)
+ original = get_opt()
+ self.assertDictEqual(original, expected)
+
+ expected['value'] = ['oink', 'boink']
+ self.setconf('-Dlist=oink,boink')
+ changed = get_opt()
+ self.assertEqual(changed, expected)
+
+ def test_array_option_bad_change(self):
+ def get_opt():
+ opts = self.introspect('--buildoptions')
+ for x in opts:
+ if x.get('name') == 'list':
+ return x
+ raise Exception(opts)
+
+ expected = {
+ 'name': 'list',
+ 'description': 'list',
+ 'type': 'stringarray',
+ 'value': ['foo', 'bar'],
+ }
+ tdir = os.path.join(self.unit_test_dir, '18 array option')
+ self.init(tdir)
+ original = get_opt()
+ self.assertDictEqual(original, expected)
+ with self.assertRaises(subprocess.CalledProcessError):
+ self.setconf('-Dlist=bad')
+ changed = get_opt()
+ self.assertDictEqual(changed, expected)
+
class FailureTests(BasePlatformTests):
'''