@@ -240,6 +240,26 @@ def test_subproject_nonexistent(self):
240
240
self .assertFalse (optstore .accept_as_pending_option (OptionKey ('foo' , subproject = 'found' ), subprojects ))
241
241
self .assertTrue (optstore .accept_as_pending_option (OptionKey ('foo' , subproject = 'whatisthis' ), subprojects ))
242
242
243
+ def test_subproject_proj_opt_with_same_name (self ):
244
+ name = 'tests'
245
+ subp = 'subp'
246
+
247
+ optstore = OptionStore (False )
248
+ prefix = UserStringOption ('prefix' , 'This is needed by OptionStore' , '/usr' )
249
+ optstore .add_system_option ('prefix' , prefix )
250
+ o = UserBooleanOption (name , 'Tests' , False )
251
+ optstore .add_project_option (OptionKey (name , subproject = '' ), o )
252
+ o = UserBooleanOption (name , 'Tests' , True )
253
+ optstore .add_project_option (OptionKey (name , subproject = subp ), o )
254
+
255
+ cmd_line = {OptionKey (name ): True }
256
+ spcall = {OptionKey (name ): False }
257
+
258
+ optstore .initialize_from_top_level_project_call ({}, cmd_line , {})
259
+ optstore .initialize_from_subproject_call (subp , spcall , {}, cmd_line , {})
260
+ self .assertEqual (optstore .get_value_for (name , '' ), True )
261
+ self .assertEqual (optstore .get_value_for (name , subp ), False )
262
+
243
263
def test_subproject_cmdline_override_global (self ):
244
264
name = 'optimization'
245
265
subp = 'subp'
0 commit comments