diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-05-07 14:10:51 +0200 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-05-07 09:43:43 -0700 |
| commit | c1b7ef4218f12905641f1cb1503c8b9b3542e983 (patch) | |
| tree | 48f8fd9e8501b9867aa75505ae60207fa8e39624 /unittests/optiontests.py | |
| parent | a46371f6d8c01953d8d8bd3d8e86594cc3c8e37f (diff) | |
| download | meson-c1b7ef4218f12905641f1cb1503c8b9b3542e983.tar.gz | |
options: fix "deprecated" with dictionary argument and non-string types
Since opt.deprecated is a dictionary with string keys, the lookup must use
str() around the user-provided value; with some care because booleans
will be the meson-ic 'true' and 'false' instead of Python's 'True' and
'False'.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'unittests/optiontests.py')
| -rw-r--r-- | unittests/optiontests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/optiontests.py b/unittests/optiontests.py index 5ed601fed..aad8eadfc 100644 --- a/unittests/optiontests.py +++ b/unittests/optiontests.py @@ -202,3 +202,14 @@ class OptionTests(unittest.TestCase): optstore = OptionStore(False) value = optstore.get_default_for_b_option(OptionKey('b_vscrt')) self.assertEqual(value, 'from_buildtype') + + def test_deprecated_nonstring_value(self): + # TODO: add a lot more deprecated option tests + optstore = OptionStore(False) + name = 'deprecated' + do = UserStringOption(name, 'An option with some deprecation', '0', + deprecated={'true': '1'}) + optstore.add_system_option(name, do) + optstore.set_option(OptionKey(name), True) + value = optstore.get_value(name) + self.assertEqual(value, '1') |
