-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semantic tokens tests: Use Linq instead #8256
Conversation
@@ -128,7 +121,7 @@ public async Task VerifyGetClassificationsAsync(IEnumerable<ClassificationSpan> | |||
} | |||
} | |||
|
|||
Assert.Equal(expectedArray.Length, actualArray.Length - actualOffset); | |||
Assert.Equal(expectedArray.Length, actualArray.Length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert is not doing anything any more: If the lengths weren't equal, we would have got index out of range exceptions on line 104/5.
I think this should be moved in front of the loop, just for good measure, and to provide a little more information than an index out of range exception would, should it ever fail.
var actualSemanticClassifications = actualClassifications.Where(a => | ||
a.ClassificationType.BaseTypes.Any() && | ||
a.ClassificationType is ILayeredClassificationType layeredClassificationType && | ||
layeredClassificationType.Layer == ClassificationLayer.Syntactic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this now change to !=
?
Definitely much easier to understand that moving two indexes. Which I didn't 😝 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is even easier to understand :)
...st/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/EditorInProcess_Classification.cs
Show resolved
Hide resolved
Oh no, I take it back. If expected is longer than actual it will help. My bad. |
Summary of the changes