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
190
190
}
191
191
192
192
[ 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 ( )
194
194
{
195
195
ArgumentResult argumentResult = null ;
196
196
@@ -202,19 +202,20 @@ public void ArgumentResult_Parent_is_set_correctly_when_token_is_present()
202
202
{
203
203
argumentResult = argResult ;
204
204
return null ;
205
- } )
205
+ } , isDefault : true )
206
206
} ;
207
207
208
- command . Parse ( "-x abc " ) ;
208
+ command . Parse ( "" ) ;
209
209
210
210
argumentResult
211
211
. Parent
212
+ . Symbol
212
213
. Should ( )
213
- . NotBeNull ( ) ;
214
+ . Be ( command . Options . Single ( ) ) ;
214
215
}
215
216
216
217
[ 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 ( )
218
219
{
219
220
ArgumentResult argumentResult = null ;
220
221
@@ -232,10 +233,11 @@ public void Option_ArgumentResult_Parent_is_set_correctly_when_token_is_implicit
232
233
command . Parse ( "" ) ;
233
234
234
235
argumentResult
236
+ . Parent
235
237
. Parent
236
238
. Symbol
237
239
. Should ( )
238
- . Be ( command . Options . Single ( ) ) ;
240
+ . Be ( command ) ;
239
241
}
240
242
241
243
[ Fact ]
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public class OptionResult : SymbolResult
13
13
internal OptionResult (
14
14
IOption option ,
15
15
Token token ,
16
- CommandResult parent = null ) :
16
+ CommandResult parent ) :
17
17
base ( option ?? throw new ArgumentNullException ( nameof ( option ) ) ,
18
18
parent )
19
19
{
Original file line number Diff line number Diff line change @@ -320,7 +320,8 @@ private void PopulateDefaultValues()
320
320
321
321
var optionResult = new OptionResult (
322
322
option ,
323
- option . CreateImplicitToken ( ) ) ;
323
+ option . CreateImplicitToken ( ) ,
324
+ commandResult ) ;
324
325
325
326
var token = new ImplicitToken (
326
327
optionResult . GetDefaultValueFor ( option . Argument ) ,
Original file line number Diff line number Diff line change 2
2
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
4
4
using System . Collections . Generic ;
5
- using System . CommandLine . Binding ;
6
5
using System . Linq ;
7
6
8
7
namespace System . CommandLine . Parsing
@@ -15,7 +14,7 @@ public abstract class SymbolResult
15
14
16
15
private protected SymbolResult (
17
16
ISymbol symbol ,
18
- SymbolResult parent = null )
17
+ SymbolResult parent )
19
18
{
20
19
Symbol = symbol ?? throw new ArgumentNullException ( nameof ( symbol ) ) ;
21
20
You can’t perform that action at this time.
0 commit comments