Skip to content

Commit a1952be

Browse files
committed
Error render test update
1 parent dc9cc82 commit a1952be

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ public void Long_pre_and_post_lines_without_spaces()
255255
public void Invoking_RenderParsingErrorsText_returns_appropriate_formatted_text()
256256
{
257257
// Fixture setup
258+
var optionsInGroup = new List<NameInfo>
259+
{
260+
new NameInfo("t", "testOption1"),
261+
new NameInfo("c", "testOption2")
262+
};
258263
var fakeResult = new NotParsed<object>(
259264
TypeInfo.Create(typeof(NullInstance)),
260265
new Error[]
@@ -267,7 +272,8 @@ public void Invoking_RenderParsingErrorsText_returns_appropriate_formatted_text(
267272
new NoVerbSelectedError(),
268273
new BadVerbSelectedError("badverb"),
269274
new HelpRequestedError(), // should be ignored
270-
new HelpVerbRequestedError(null, null, false) // should be ignored
275+
new HelpVerbRequestedError(null, null, false), // should be ignored
276+
new MissingGroupOptionError("bad-option-group", optionsInGroup),
271277
});
272278
Func<Error, string> fakeRenderer = err =>
273279
{
@@ -287,6 +293,11 @@ public void Invoking_RenderParsingErrorsText_returns_appropriate_formatted_text(
287293
return "ERR no-verb-selected";
288294
case ErrorType.BadVerbSelectedError:
289295
return "ERR " + ((BadVerbSelectedError)err).Token;
296+
case ErrorType.MissingGroupOptionError:
297+
{
298+
var groupErr = (MissingGroupOptionError)err;
299+
return "ERR " + groupErr.Group + ": " + string.Join("---", groupErr.Names.Select(n => n.NameText));
300+
}
290301
default:
291302
throw new InvalidOperationException();
292303
}
@@ -306,6 +317,7 @@ public void Invoking_RenderParsingErrorsText_returns_appropriate_formatted_text(
306317
lines[4].Should().BeEquivalentTo(" ERR s, sequence");
307318
lines[5].Should().BeEquivalentTo(" ERR no-verb-selected");
308319
lines[6].Should().BeEquivalentTo(" ERR badverb");
320+
lines[7].Should().BeEquivalentTo(" ERR bad-option-group: t, testOption1---c, testOption2");
309321
// Teardown
310322
}
311323

0 commit comments

Comments
 (0)