dotnet/roslyn

Generate expected source file for the whole unit test session

Open

#26,161 创建于 2018年4月14日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)C# (20,414 star) (4,257 fork)batch import
Area-CompilersTesthelp wanted

描述

I found this method in the test suite: TryGenerateExpectedSourceFileAndGetDiffLink

It generates the whole source file with just the expected assertion string replaced with actual.

It has some limitations and cannot be used for bulk baseline changes,

  • It only works if a diff tool is available
  • It only works for a single test

The most needed methods that need to have this is VerifyIL and VerifyDiagnostics mainly in case of bulk baseline changes.

The idea is that to keep a single file and apply new changes to that file so the expected source file contains changes for all tests in the file.

However, in order to do that, we should keep track of line numbers because they might get out of date once a test expected string is updated in the source.

Also, since VerifyDiagnostics accepts a params, we can't have line number at all. maybe fallback to stackframe? (my motivating use case for this feature request https://github.com/dotnet/csharplang/issues/1458)

Thoughts?

/cc @tmat

贡献者指南