summaryrefslogtreecommitdiff
path: root/unittests/optiontests.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-05-19 11:04:11 +0200
committerEli Schwartz <eschwartz93@gmail.com>2025-05-21 21:41:40 -0400
commitcc382b237ac88b14210e0292940394385cab31f6 (patch)
tree2de9d0cd9fdd23638a29bc9ff6bdc0da23a02493 /unittests/optiontests.py
parent8f4f16521751fe48ba20f0d0b8c7a7d4097815d6 (diff)
downloadmeson-cc382b237ac88b14210e0292940394385cab31f6.tar.gz
options: commonize code to accept unknown options
The check for unknown options is duplicated in OptionStore and MesonApp. Place the better version of the two as a new method of OptionStore, and use it in OptionStore.validate_cmd_line_options. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'unittests/optiontests.py')
-rw-r--r--unittests/optiontests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/optiontests.py b/unittests/optiontests.py
index aad8eadfc..416da8f47 100644
--- a/unittests/optiontests.py
+++ b/unittests/optiontests.py
@@ -203,6 +203,17 @@ class OptionTests(unittest.TestCase):
value = optstore.get_default_for_b_option(OptionKey('b_vscrt'))
self.assertEqual(value, 'from_buildtype')
+ def test_b_nonexistent(self):
+ optstore = OptionStore(False)
+ assert optstore.accept_as_pending_option(OptionKey('b_ndebug'))
+ assert not optstore.accept_as_pending_option(OptionKey('b_whatever'))
+
+ def test_subproject_nonexistent(self):
+ optstore = OptionStore(False)
+ subprojects = {'found'}
+ assert not optstore.accept_as_pending_option(OptionKey('foo', subproject='found'), subprojects)
+ assert optstore.accept_as_pending_option(OptionKey('foo', subproject='whatisthis'), subprojects)
+
def test_deprecated_nonstring_value(self):
# TODO: add a lot more deprecated option tests
optstore = OptionStore(False)