-
Notifications
You must be signed in to change notification settings - Fork 199
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
Share formatting tests between cohosting and LSP server #11264
Share formatting tests between cohosting and LSP server #11264
Conversation
These don't exist in cohosting, so can't be shared
On my machine this caused 0 difference in test time, and XUnit fixtures seem at odds with creating custom test discoverers, which I want to do to add fuse testing to cohosting.
This commit was purely mechanical, no changes to any test inputs or outputs. The old file name differentiation made no sense, and its easier to share a single file.
RazorLSPOptions doesn't make sense in cohosting
This makes the test count between the two systems the same, for easy validation that we're doing the right thing
My assumption at the start, that it would be incompatible, was incorrect.
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.
Love this!
src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Formatting/FormattingTestAttribute.cs
Outdated
Show resolved
Hide resolved
src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Formatting/FormattingTestAttribute.cs
Outdated
Show resolved
Hide resolved
src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Formatting/FormattingFactDiscoverer.cs
Outdated
Show resolved
Hide resolved
[XunitTestCaseDiscoverer("Microsoft.AspNetCore.Razor.Test.Common." + nameof(FormattingFactDiscoverer), "Microsoft.AspNetCore.Razor.Test.Common")] | ||
internal class FormattingTestFactAttribute : FactAttribute | ||
{ | ||
public bool SkipFlipLineEnding { get; set; } |
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.
🚲 bike-shedding: should this just be ShouldFilpLineEnding
and have a default value of true
?
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.
Going to agree to disagree here, Skip feels more "standard" in the test attribute usage itself.
src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Formatting/FormattingTestTheoryAttribute.cs
Outdated
Show resolved
Hide resolved
src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/FormattingTestBase.cs
Outdated
Show resolved
Hide resolved
src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/FormattingTestBase.cs
Outdated
Show resolved
Hide resolved
src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/FormattingTestBase.cs
Outdated
Show resolved
Hide resolved
...r/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs
Outdated
Show resolved
Hide resolved
...r/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs
Outdated
Show resolved
Hide resolved
For you, and for me, and the entire human race
Going to merge this. The only reason for a compiler review is changes to shared code, but they're only test attributes used by tooling tests. |
Fixes #11235
This PR shares all document and range formatting tests between cohosting and the existing LSP server tests. It also correctly represents the actual test coverage of the LSP server tests by splitting out line ending and fuse into test cases. This means cohost goes from 4 test cases to 540. Not a bad increase.
Commit-at-a-time tells the story, but honestly, if you can ignore the moves of all of the tests (which are purely mechanical I promise) it's probably easier not to bother.
Language server tests look like this:

Cohosting tests can look as awesome as this:
