Writing unit tests for a new error in the C# compiler code base
This section will enable you to add unit tests to the C# compiler. This has the following set of unit test projects in Roslyn.sln:
CSharpCompilerSyntaxTest
: Unit tests for parsing and syntax errorsCSharpCompilerSemanticTest
: Unit tests for semantic errors and semantic model APIsCSharpCompilerSymbolTest
: Unit tests for symbols defined in the compiler layerCSharpCommandLineTest
: Unit tests for the compiler's command-line optionsCSharpCompilerEmitTest
: Unit tests for the code generation phase that verify the generated MSIL
In this section, we will add unit tests to CSharpCompilerSemanticTest
for a newly added semantic error.
Getting Started
You need to ensure that you have executed the previous recipe in this chapter, Implementing a new semantic error in the C# compiler code base, to add a new semantic diagnostic to the C# compiler: Warning CS0823: Use an explicit type for declaration as the initializer type '{0}' is not apparent due...