Skip to content

Commit 6c72258

Browse files
bonzininirbheek
authored andcommitted
options: fix misindentation
Ensure that valobj.yielding is cleared for options in the toplevel project. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent bf86466 commit 6c72258

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

mesonbuild/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ def add_project_option(self, key: T.Union[OptionKey, str], valobj: AnyOptionType
937937
# Subproject is set to yield, but top level
938938
# project does not have an option of the same
939939
pass
940-
valobj.yielding = bool(valobj.parent)
940+
valobj.yielding = bool(valobj.parent)
941941

942942
self.options[key] = valobj
943943
self.project_options.add(key)

unittests/optiontests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ def test_project_nonyielding(self):
121121
self.assertEqual(optstore.get_value_for(name, 'sub'), sub_value)
122122
self.assertEqual(num_options(optstore), 2)
123123

124+
def test_toplevel_project_yielding(self):
125+
optstore = OptionStore(False)
126+
name = 'someoption'
127+
top_value = 'top'
128+
vo = UserStringOption(name, 'A top level option', top_value, True)
129+
optstore.add_project_option(OptionKey(name, ''), vo)
130+
self.assertEqual(optstore.get_value_for(name, ''), top_value)
131+
124132
def test_project_yielding(self):
125133
optstore = OptionStore(False)
126134
name = 'someoption'

0 commit comments

Comments
 (0)