141 references to WithFeature
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (27)
CodeGen\ForeachTest.cs (1)
1683
var comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.
WithFeature
("run-nullable-analysis", "never"));
Emit\EmitErrorTests.cs (3)
355
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "1000000"))
359
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals"),
364
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"),
Emit\EmitMetadataTests.cs (23)
2950
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"));
2956
comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"));
2962
comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"));
2971
comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "1"));
2980
comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "3"));
3023
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", null),
3034
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", feature),
3042
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "1000"),
3049
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "3"),
3056
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "2"),
3076
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "1"),
3096
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"),
3131
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"),
3232
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"));
3244
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"),
3282
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"))
3297
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"),
3398
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", feature),
3423
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"),
3465
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"),
3511
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"),
3548
parseOptions: TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0"),
3623
parseOptions: parseOptions.
WithFeature
("experimental-data-section-string-literals", "0"))
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (3)
Emit\EditAndContinue\EditAndContinueTests.cs (3)
16679
var parseOptions = TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0");
19903
var parseOptions = TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0");
20002
var parseOptions = TestOptions.Regular.
WithFeature
("experimental-data-section-string-literals", "0");
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (9)
Attributes\AttributeTests_Nullable.cs (4)
3473
AssertNullableAttributes(CreateCompilation(source, options: options, parseOptions: parseOptions.
WithFeature
("nullablePublicOnly")), expectedPublicOnly);
3475
AssertNullableAttributes(CreateCompilation(new[] { source, sourceIVTs }, options: options, parseOptions: parseOptions.
WithFeature
("nullablePublicOnly")), expectedPublicAndInternal);
3590
comp = CreateCompilation(new[] { sourceAttribute, source }, options: options, parseOptions: parseOptions.
WithFeature
("nullablePublicOnly"));
3649
comp = CreateCompilation(new[] { sourceAttribute, source }, options: options, parseOptions: parseOptions.
WithFeature
("nullablePublicOnly"));
Semantics\ExtensionTests.cs (1)
33660
var verifier = CompileAndVerify(source, expectedOutput: "23", parseOptions: TestOptions.RegularPreview.
WithFeature
("run-nullable-analysis", "never")); // Tracked by https://github.com/dotnet/roslyn/issues/76130: Nullable analysis asserts
Semantics\PrimaryConstructorTests.cs (2)
6828
var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview.
WithFeature
("run-nullable-analysis", "never"), targetFramework: TargetFramework.NetCoreApp);
6854
var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview.
WithFeature
("run-nullable-analysis", "never"), targetFramework: TargetFramework.NetCoreApp);
Semantics\RecordTests.cs (2)
30471
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "never"), targetFramework: TargetFramework.NetCoreApp);
30495
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "never"), targetFramework: TargetFramework.NetCoreApp);
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (1)
EndToEndTests.cs (1)
682
var verifier = CompileAndVerify(files.ToArrayAndFree(), parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "global"), expectedOutput: makeExpectedOutput());
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (79)
Semantics\InterceptorsTests.cs (32)
36
private static readonly CSharpParseOptions RegularWithInterceptors = TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "global");
120
comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsPreview-experimental"));
123
comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsPreview", "false"));
126
comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("interceptorspreview"));
129
comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsPreview", "Global"));
132
comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsPreview", "global.a"));
165
var comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "NS"));
171
comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "NS1.NS2"));
177
var verifier = CompileAndVerify([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "NS1"), expectedOutput: "1");
180
verifier = CompileAndVerify([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "NS1;NS2"), expectedOutput: "1");
187
test(TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "NS"), expectedOutput: null,
192
test(TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "NS1.NS2"), expectedOutput: null,
197
test(TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "NS1"), expectedOutput: "1");
199
test(TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "NS1;NS2"), expectedOutput: "1");
294
var comp = CreateCompilation([source, interceptor, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", featureValue));
303
var verifier = CompileAndVerify([source, interceptor, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", featureValue), expectedOutput: "1");
331
var comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", ""));
363
var verifier = CompileAndVerify([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "global"), expectedOutput: "1");
366
verifier = CompileAndVerify([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "global"), expectedOutput: "1");
397
var comp = CreateCompilation([source, interceptors, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "global.A"));
6825
var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors"));
6872
var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors"));
6925
var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors"));
6974
var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors"));
7030
var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors"));
7078
var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors"));
7125
var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: featureExists ? TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "") : TestOptions.Regular);
7169
var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors;Interceptors"));
7197
var comp = CreateCompilation(new[] { source, s_attributesSource }, parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors"));
7216
var comp = CreateCompilation([], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors"));
7256
var comp = CreateCompilation(new[] { source, interceptorSource, s_attributesSource }, parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", @namespace));
7299
var comp = CreateCompilation([source, interceptorSource, s_attributesSource], parseOptions: TestOptions.Regular.
WithFeature
("InterceptorsNamespaces", "Interceptors.Nested"));
Semantics\LocalFunctionTests.cs (3)
2369
var comp = CreateCompilation(src, options: TestOptions.UnsafeDebugDll, parseOptions: TestOptions.Regular12.
WithFeature
("run-nullable-analysis", "never"));
2441
CreateCompilation(src, options: TestOptions.UnsafeDebugDll, parseOptions: TestOptions.Regular13.
WithFeature
("run-nullable-analysis", "never")).VerifyDiagnostics(expectedDiagnostics);
2442
CreateCompilation(src, options: TestOptions.UnsafeDebugDll, parseOptions: TestOptions.RegularPreview.
WithFeature
("run-nullable-analysis", "never")).VerifyDiagnostics(expectedDiagnostics);
Semantics\NullableContextTests.cs (23)
185
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", null), expectedAnalyzedKeysDefault);
186
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), expectedAnalyzedKeysAll);
187
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "never"));
188
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "ALWAYS"), expectedAnalyzedKeysDefault); // unrecognized value (incorrect case) ignored
189
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "NEVER"), expectedAnalyzedKeysDefault); // unrecognized value (incorrect case) ignored
190
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "true"), expectedAnalyzedKeysDefault); // unrecognized value ignored
191
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "false"), expectedAnalyzedKeysDefault); // unrecognized value ignored
192
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "unknown"), expectedAnalyzedKeysDefault); // unrecognized value ignored
239
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", null), expectedAnalyzedKeysDefault);
240
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), expectedAnalyzedKeysAll);
241
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "never"));
298
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", null), expectedAnalyzedKeysDefault);
299
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), expectedAnalyzedKeysAll);
300
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "never"));
340
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", null), expectedFlowState: true, expectedAnalyzedKeysAll);
341
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), expectedFlowState: true, expectedAnalyzedKeysAll);
342
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "never"), expectedFlowState: false);
379
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", null), expectedFlowState: true, expectedAnalyzedKeysAll);
380
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), expectedFlowState: true, expectedAnalyzedKeysAll);
381
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "never"), expectedFlowState: false);
414
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", null), expectedFlowState: true, expectedAnalyzedKeysAll);
415
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), expectedFlowState: true, expectedAnalyzedKeysAll);
416
verify(parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "never"), expectedFlowState: false);
Semantics\NullableReferenceTypesTests.cs (11)
5239
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), options: TestOptions.DebugDll);
5285
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), options: TestOptions.DebugDll.WithNullableContextOptions(NullableContextOptions.Disable));
5331
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), options: TestOptions.DebugDll.WithNullableContextOptions(NullableContextOptions.Enable));
10611
var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), options: WithNullableEnable());
10770
var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), options: WithNullableEnable());
10933
var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), options: WithNullableEnable());
11123
var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), options: WithNullableEnable());
71817
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "always"), options: WithNullableEnable());
81195
parseOptions: TestOptions.Regular8.
WithFeature
("staticNullChecking"));
81206
parseOptions: TestOptions.Regular8.
WithFeature
("staticNullChecking", "0"));
81217
parseOptions: TestOptions.Regular8.
WithFeature
("staticNullChecking", "1"));
Semantics\RefFieldTests.cs (8)
8390
var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview.
WithFeature
("peverify-compat"), targetFramework: TargetFramework.Net70);
13499
comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.
WithFeature
("run-nullable-analysis", "never"));
13563
comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.
WithFeature
("run-nullable-analysis", "never"));
13639
comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.
WithFeature
("run-nullable-analysis", "never"));
13710
comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.
WithFeature
("run-nullable-analysis", "never"));
15192
comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.
WithFeature
("run-nullable-analysis", "never"));
28013
comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.
WithFeature
("run-nullable-analysis", "never"));
28073
comp = CreateCompilation(source, parseOptions: TestOptions.RegularDefault.
WithFeature
("run-nullable-analysis", "never"));
Semantics\UsingStatementTests.cs (1)
1848
var compilation = CreateCompilation(source, parseOptions: TestOptions.Regular.
WithFeature
("run-nullable-analysis", "never"));
SourceGeneration\GeneratorDriverTests.cs (1)
4279
var parseOptions = TestOptions.RegularPreview.
WithFeature
("InterceptorsNamespaces", "global");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (4)
Symbols\Source\NullablePublicAPITests.cs (4)
1737
var featureFlagOff = TestOptions.Regular8.
WithFeature
("run-nullable-analysis", "never");
2623
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular8.
WithFeature
("run-nullable-analysis", flagState));
5181
var comp = CreateCompilation(source, parseOptions: runNullableAnalysisAlways ? TestOptions.RegularPreview.
WithFeature
("run-nullable-analysis", "always") : TestOptions.RegularPreview);
5219
var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview.
WithFeature
("run-nullable-analysis", "never"));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (14)
Parsing\IgnoredDirectiveParsingTests.cs (14)
73
UsingTree(source, options.
WithFeature
(FeatureName));
110
parseOptions: TestOptions.Regular.
WithFeature
(FeatureName),
120
var root = SyntaxFactory.ParseCompilationUnit(source, options: TestOptions.Regular.
WithFeature
(FeatureName));
142
var root = SyntaxFactory.ParseCompilationUnit(source, options: TestOptions.Regular.
WithFeature
(FeatureName));
162
var root = SyntaxFactory.ParseCompilationUnit("#!abc", options: TestOptions.Regular.
WithFeature
(FeatureName));
179
options = options.
WithFeature
(FeatureName);
235
UsingTree(source, TestOptions.Regular.
WithFeature
(FeatureName),
302
UsingTree(source, TestOptions.Regular.
WithFeature
(FeatureName),
381
UsingTree(source, TestOptions.Regular.
WithFeature
(FeatureName));
421
UsingTree(source, TestOptions.Regular.
WithFeature
(FeatureName));
470
UsingTree(source, TestOptions.Regular.
WithFeature
(FeatureName));
497
UsingTree(source, TestOptions.Regular.
WithFeature
(FeatureName),
539
UsingTree(source, TestOptions.Regular.
WithFeature
(FeatureName));
564
UsingTree(source, TestOptions.Regular.
WithFeature
(FeatureName),
Microsoft.CodeAnalysis.CSharp.Test.Utilities (4)
TestOptions.cs (4)
48
public static readonly CSharpParseOptions RegularWithLegacyStrongName = Regular.
WithFeature
("UseLegacyStrongNameProvider");
133
return options.
WithFeature
("nullablePublicOnly");
138
return options.
WithFeature
("noRefSafetyRulesAttribute");
143
return options.
WithFeature
("disable-length-based-switch");