Skip to content
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

Add unit test for 3rd party fixer formatting #896

Merged
merged 7 commits into from
Dec 11, 2020

Conversation

JoeRobich
Copy link
Member

Adds infrastructure for testing that 3rd party fixes are applied during formatting.

Part of the work for #717


Build.Framework.ILogger? binlog = null;
if (createBinaryLog)
await s_guard.WaitAsync();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because tests run in parallel but msbuild won't

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still don't quite understand this. Why can't each test create their own workspace?

Copy link
Member Author

@JoeRobich JoeRobich Dec 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the CodeFormatterTests is creating MSBuildWorkspaces and now we are creating a MSBuildWorkspace here, there is an InvalidOperationException "Cannot start a new build while a build is in progress", since they are running parallel.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we create a WorspaceFact that controls this intead of changing product code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a stab at this in #899


namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers
{
public class CodeStyleAnalyzerFormatterTests : CSharpFormatterTests
{
private protected override ICodeFormatter Formatter => AnalyzerFormatter.CodeStyleFormatter;

public CodeStyleAnalyzerFormatterTests(ITestOutputHelper output)
{
TestOutputHelper = output;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On failure of any tests in the class, the formatter log will be written to the test output.

@JoeRobich JoeRobich merged commit edae80b into dotnet:master Dec 11, 2020
@JoeRobich JoeRobich deleted the add-thirdparty-test branch March 5, 2021 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants