Skip to content

Commit 0bcfea6

Browse files
0xcedpatriksvensson
authored andcommitted
Ensure that "The value '…' is not in a correct format" ends with a new line
It's weird when an error message doesn't have a newline in a CLI app. Note that all other CommandParseException exceptions created through CommandLineParseExceptionFactory are properly ended with a new line.
1 parent fc8e74b commit 0bcfea6

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/Spectre.Console.Cli.Tests/CommandAppTests.Pairs.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void Should_Throw_If_Value_Is_Not_In_A_Valid_Format_Using_Default_Deconst
192192
string input, string expected)
193193
{
194194
// Given
195-
var app = new CommandAppTester();
195+
var app = new CommandAppTester { TestSettings = { TrimConsoleOutput = false } };
196196
app.SetDefaultCommand<GenericCommand<DefaultPairDeconstructorSettings>>();
197197

198198
// When
@@ -203,7 +203,7 @@ public void Should_Throw_If_Value_Is_Not_In_A_Valid_Format_Using_Default_Deconst
203203

204204
// Then
205205
result.ExitCode.ShouldBe(-1);
206-
result.Output.ShouldBe(expected);
206+
result.Output.ShouldBe(expected + Environment.NewLine);
207207
}
208208

209209
[Fact]

‎src/Spectre.Console.Cli/CommandParseException.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ internal static CommandParseException UnknownOption(IEnumerable<string> args, Co
110110

111111
internal static CommandParseException ValueIsNotInValidFormat(string value)
112112
{
113-
var text = $"[red]Error:[/] The value '[white]{value}[/]' is not in a correct format";
113+
var text = $"[red]Error:[/] The value '[white]{value}[/]' is not in a correct format{Environment.NewLine}";
114114
return new CommandParseException("Could not parse value", new Markup(text));
115115
}
116116

0 commit comments

Comments
 (0)