Improve lambda signature formatting

This commit is contained in:
Alexander Kozlenko 2017-12-22 01:26:18 +02:00 committed by Ben Adams
parent b5b3a19b66
commit e5ef6c5fac
4 changed files with 9 additions and 9 deletions

View File

@ -132,7 +132,7 @@ namespace System.Diagnostics
builder.Append(")"); builder.Append(")");
if (IsLambda) if (IsLambda)
{ {
builder.Append("=>{}"); builder.Append(" => { }");
if (Ordinal.HasValue) if (Ordinal.HasValue)
{ {

View File

@ -38,7 +38,7 @@ namespace Demystify
var trace = string.Join("", stackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) var trace = string.Join("", stackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
// Remove items that vary between test runners // Remove items that vary between test runners
.Where(s => .Where(s =>
s != " at Task Demystify.DynamicCompilation.DoesNotPreventStackTrace()+()=>{}" && s != " at Task Demystify.DynamicCompilation.DoesNotPreventStackTrace()+() => { }" &&
!s.Contains("System.Threading.Tasks.Task.WaitAll") !s.Contains("System.Threading.Tasks.Task.WaitAll")
) )
.Skip(1) .Skip(1)
@ -48,18 +48,18 @@ namespace Demystify
var expected = string.Join("", new[] { var expected = string.Join("", new[] {
" at async Task Demystify.AggregateException.Throw1()", " at async Task Demystify.AggregateException.Throw1()",
" at async void Demystify.AggregateException.DemystifiesAggregateExceptions()+(?)=>{}", " at async void Demystify.AggregateException.DemystifiesAggregateExceptions()+(?) => { }",
" --- End of inner exception stack trace ---", " --- End of inner exception stack trace ---",
" at void Demystify.AggregateException.DemystifiesAggregateExceptions()", " at void Demystify.AggregateException.DemystifiesAggregateExceptions()",
"---> (Inner Exception #0) System.ArgumentException: Value does not fall within the expected range.", "---> (Inner Exception #0) System.ArgumentException: Value does not fall within the expected range.",
" at async Task Demystify.AggregateException.Throw1()", " at async Task Demystify.AggregateException.Throw1()",
" at async void Demystify.AggregateException.DemystifiesAggregateExceptions()+(?)=>{}", " at async void Demystify.AggregateException.DemystifiesAggregateExceptions()+(?) => { }",
"---> (Inner Exception #1) System.NullReferenceException: Object reference not set to an instance of an object.", "---> (Inner Exception #1) System.NullReferenceException: Object reference not set to an instance of an object.",
" at async Task Demystify.AggregateException.Throw2()", " at async Task Demystify.AggregateException.Throw2()",
" at async void Demystify.AggregateException.DemystifiesAggregateExceptions()+(?)=>{}", " at async void Demystify.AggregateException.DemystifiesAggregateExceptions()+(?) => { }",
"---> (Inner Exception #2) System.InvalidOperationException: Operation is not valid due to the current state of the object.", "---> (Inner Exception #2) System.InvalidOperationException: Operation is not valid due to the current state of the object.",
" at async Task Demystify.AggregateException.Throw3()", " at async Task Demystify.AggregateException.Throw3()",
" at async void Demystify.AggregateException.DemystifiesAggregateExceptions()+(?)=>{}"}); " at async void Demystify.AggregateException.DemystifiesAggregateExceptions()+(?) => { }"});
Assert.Equal(expected, trace); Assert.Equal(expected, trace);
} }

View File

@ -42,7 +42,7 @@ namespace Demystify
// Remove items that vary between test runners // Remove items that vary between test runners
.Where(s => .Where(s =>
s != " at void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, object state)" && s != " at void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, object state)" &&
s != " at Task Demystify.DynamicCompilation.DoesNotPreventStackTrace()+()=>{}" s != " at Task Demystify.DynamicCompilation.DoesNotPreventStackTrace()+() => { }"
) )
.ToArray(); .ToArray();

View File

@ -34,7 +34,7 @@ namespace Demystify
Assert.Equal( Assert.Equal(
new[] { new[] {
"System.Exception: Exception of type 'System.Exception' was thrown. ---> System.Exception: Exception of type 'System.Exception' was thrown.", "System.Exception: Exception of type 'System.Exception' was thrown. ---> System.Exception: Exception of type 'System.Exception' was thrown.",
" at Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()+()=>{}", " at Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()+() => { }",
" at async Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()", " at async Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()",
" --- End of inner exception stack trace ---"}, " --- End of inner exception stack trace ---"},
trace); trace);
@ -57,7 +57,7 @@ namespace Demystify
Assert.Equal( Assert.Equal(
new[] { new[] {
"System.Exception: Exception of type 'System.Exception' was thrown. ---> System.Exception: Exception of type 'System.Exception' was thrown.", "System.Exception: Exception of type 'System.Exception' was thrown. ---> System.Exception: Exception of type 'System.Exception' was thrown.",
" at Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()+()=>{}", " at Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()+() => { }",
" at async Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()", " at async Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()",
" --- End of inner exception stack trace ---", " --- End of inner exception stack trace ---",
" at async Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()" " at async Task Demystify.NonThrownException.DoesNotPreventThrowStackTrace()"