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);
// 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);
internal static CSharpCompilation WithSource(this CSharpCompilation compilation, CSharpTestSource newSource) { return(compilation.RemoveAllSyntaxTrees().AddSyntaxTrees(newSource.GetSyntaxTrees(TestOptions.Regular))); }
internal static CSharpCompilation WithSource(this CSharpCompilation compilation, CSharpTestSource newSource) { var previousParseOptions = (CSharpParseOptions)compilation.SyntaxTrees.FirstOrDefault()?.Options; return(compilation.RemoveAllSyntaxTrees().AddSyntaxTrees(newSource.GetSyntaxTrees(previousParseOptions))); }
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);
private static CSharpCompilation CreateCompilation(CSharpTestSource source) => CSharpTestBase.CreateCompilation(new[] { source, IsExternalInitTypeDefinition }, parseOptions: TestOptions.RegularPreview);