diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-12-02 19:54:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-02 19:54:27 +0200 |
commit | 793fc002fa3c414cee20b3b3a4397eeb3ce3d35e (patch) | |
tree | 6d299980e2bdb44823e3dd109037241a5f8498df /run_unittests.py | |
parent | e1bdc098ca48990322b058e2a2a9fce16c3e7674 (diff) | |
parent | c9351ce30c03d107279090da7825096951a705d3 (diff) | |
download | meson-793fc002fa3c414cee20b3b3a4397eeb3ce3d35e.zip meson-793fc002fa3c414cee20b3b3a4397eeb3ce3d35e.tar.gz meson-793fc002fa3c414cee20b3b3a4397eeb3ce3d35e.tar.bz2 |
Merge pull request #2390 from dcbaker/submit/options-list
Add an array type to user options
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 48 |
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): ''' |