dotnet/roslyn

Generate expected source file for the whole unit test session

オープン

#26,161 opened on 2018/04/14

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)C# (4,257 件のフォーク)batch import
Area-CompilersTesthelp wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

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

コントリビューターガイド