diff options
| -rw-r--r-- | mesonbuild/options.py | 3 | ||||
| -rw-r--r-- | unittests/optiontests.py | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/mesonbuild/options.py b/mesonbuild/options.py index b9f17cf72..346abcc3a 100644 --- a/mesonbuild/options.py +++ b/mesonbuild/options.py @@ -1117,6 +1117,9 @@ class OptionStore: del self.augments[key] dirty = True else: + if key not in self.options: + raise MesonException(f"Unknown option: {key}") + # TODO: For project options, "dropping an augment" means going # back to the superproject's value. However, it's confusing # that -U does not simply remove the option from the stored diff --git a/unittests/optiontests.py b/unittests/optiontests.py index 19ff8b43b..8f49a804e 100644 --- a/unittests/optiontests.py +++ b/unittests/optiontests.py @@ -331,6 +331,11 @@ class OptionTests(unittest.TestCase): optstore = OptionStore(False) optstore.set_from_configure_command({OptionKey('b_ndebug'): True}) + def test_unconfigure_nonexistent(self): + optstore = OptionStore(False) + with self.assertRaises(MesonException): + optstore.set_from_configure_command({OptionKey('nonexistent'): None}) + def test_subproject_proj_opt_with_same_name(self): name = 'tests' subp = 'subp' |
