Writing unit tests for C# parsing, binding, and codegen phases
This section will enable you to add unit tests for a new C# language feature: Switch operator (?::)
. For details on the intended functionality of this operator, read the section, New language feature: Switch Operator (?::), at the start of this chapter.
C# compiler has the following set of unit test projects in Roslyn.sln:
CSharpCompilerSyntaxTest
: This unit tests for parsing and syntax errors.CSharpCompilerSemanticTest
: This unit tests for semantic errors and semantic model APIs.CSharpCompilerSymbolTest
: This unit tests for symbols defined in the compiler layer.CSharpCommandLineTest
: This unit tests for the compiler's command line options.CSharpCompilerEmitTest
: This unit tests for the code generation phase that verifies the generated MSIL.
In this section, we will add unit tests to CSharpCompilerSyntaxTest
,CSharpCompilerSemanticTest
and CSharpCompilerEmitTest
for parsing, binding, and codegen support, respectively.