File tree Expand file tree Collapse file tree 4 files changed +12
-10
lines changed
System.CommandLine/Parsing Expand file tree Collapse file tree 4 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ public void custom_parsing_of_scalar_value_from_an_argument_with_multiple_tokens
190190 }
191191
192192 [ Fact ]
193- public void ArgumentResult_Parent_is_set_correctly_when_token_is_present ( )
193+ public void Option_ArgumentResult_Parent_is_set_correctly_when_token_is_implicit ( )
194194 {
195195 ArgumentResult argumentResult = null ;
196196
@@ -202,19 +202,20 @@ public void ArgumentResult_Parent_is_set_correctly_when_token_is_present()
202202 {
203203 argumentResult = argResult ;
204204 return null ;
205- } )
205+ } , isDefault : true )
206206 } ;
207207
208- command . Parse ( "-x abc " ) ;
208+ command . Parse ( "" ) ;
209209
210210 argumentResult
211211 . Parent
212+ . Symbol
212213 . Should ( )
213- . NotBeNull ( ) ;
214+ . Be ( command . Options . Single ( ) ) ;
214215 }
215216
216217 [ Fact ]
217- public void Option_ArgumentResult_Parent_is_set_correctly_when_token_is_implicit ( )
218+ public void Option_ArgumentResult_parentage_to_root_symbol_is_set_correctly_when_token_is_implicit ( )
218219 {
219220 ArgumentResult argumentResult = null ;
220221
@@ -232,10 +233,11 @@ public void Option_ArgumentResult_Parent_is_set_correctly_when_token_is_implicit
232233 command . Parse ( "" ) ;
233234
234235 argumentResult
236+ . Parent
235237 . Parent
236238 . Symbol
237239 . Should ( )
238- . Be ( command . Options . Single ( ) ) ;
240+ . Be ( command ) ;
239241 }
240242
241243 [ Fact ]
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public class OptionResult : SymbolResult
1313 internal OptionResult (
1414 IOption option ,
1515 Token token ,
16- CommandResult parent = null ) :
16+ CommandResult parent ) :
1717 base ( option ?? throw new ArgumentNullException ( nameof ( option ) ) ,
1818 parent )
1919 {
Original file line number Diff line number Diff line change @@ -320,7 +320,8 @@ private void PopulateDefaultValues()
320320
321321 var optionResult = new OptionResult (
322322 option ,
323- option . CreateImplicitToken ( ) ) ;
323+ option . CreateImplicitToken ( ) ,
324+ commandResult ) ;
324325
325326 var token = new ImplicitToken (
326327 optionResult . GetDefaultValueFor ( option . Argument ) ,
Original file line number Diff line number Diff line change 22// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
44using System . Collections . Generic ;
5- using System . CommandLine . Binding ;
65using System . Linq ;
76
87namespace System . CommandLine . Parsing
@@ -15,7 +14,7 @@ public abstract class SymbolResult
1514
1615 private protected SymbolResult (
1716 ISymbol symbol ,
18- SymbolResult parent = null )
17+ SymbolResult parent )
1918 {
2019 Symbol = symbol ?? throw new ArgumentNullException ( nameof ( symbol ) ) ;
2120
You can’t perform that action at this time.
0 commit comments