Esempio n. 1
0
 internal CompilationVerifier VerifyInPreview(CSharpTestSource source, string expectedOutput, Action <ModuleSymbol>?symbolValidator = null, params DiagnosticDescription[] expected)
 => CompileAndVerify(
     source,
     options: TestOptions.DebugExe.WithMetadataImportOptions(MetadataImportOptions.All),
     parseOptions: TestOptions.RegularPreview,
     symbolValidator: symbolValidator,
     expectedOutput: expectedOutput)
 .VerifyDiagnostics(expected);
Esempio n. 2
0
 // This method should be removed once the lambda discard parameters feature is slotted into a C# language version
 public new static CSharpCompilation CreateCompilation(
     CSharpTestSource source,
     System.Collections.Generic.IEnumerable <MetadataReference> references = null,
     CSharpCompilationOptions options = null,
     CSharpParseOptions parseOptions  = null,
     Roslyn.Test.Utilities.TargetFramework targetFramework = Roslyn.Test.Utilities.TargetFramework.Standard,
     string assemblyName     = "",
     string sourceFileName   = "",
     bool skipUsesIsNullable = false)
 => CSharpTestBase.CreateCompilation(source, references, options, parseOptions: parseOptions ?? TestOptions.RegularPreview, targetFramework, assemblyName, sourceFileName, skipUsesIsNullable);
Esempio n. 3
0
 internal static CSharpCompilation WithSource(this CSharpCompilation compilation, CSharpTestSource newSource)
 {
     return(compilation.RemoveAllSyntaxTrees().AddSyntaxTrees(newSource.GetSyntaxTrees(TestOptions.Regular)));
 }
Esempio n. 4
0
        internal static CSharpCompilation WithSource(this CSharpCompilation compilation, CSharpTestSource newSource)
        {
            var previousParseOptions = (CSharpParseOptions)compilation.SyntaxTrees.FirstOrDefault()?.Options;

            return(compilation.RemoveAllSyntaxTrees().AddSyntaxTrees(newSource.GetSyntaxTrees(previousParseOptions)));
        }
Esempio n. 5
0
 private CompilationVerifier CompileAndVerify(CSharpTestSource src, string?expectedOutput = null)
 => base.CompileAndVerify(new[] { src, IsExternalInitTypeDefinition },
                          expectedOutput: expectedOutput,
                          parseOptions: TestOptions.RegularPreview,
                          // init-only fails verification
                          verify: Verification.Skipped);
Esempio n. 6
0
 private static CSharpCompilation CreateCompilation(CSharpTestSource source)
 => CSharpTestBase.CreateCompilation(new[] { source, IsExternalInitTypeDefinition }, parseOptions: TestOptions.RegularPreview);