Skip to content

Commit

Permalink
Remove light-ups to get tests working
Browse files Browse the repository at this point in the history
I don't so much care that someone with NRT will get duplicate diagnostics when returning null.
  • Loading branch information
AArnott committed Apr 18, 2020
1 parent d3f9efc commit a1d1d41
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 680 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</ItemDefinitionGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.9.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.6" PrivateAssets="all" />
<PackageReference Include="MicroBuild.VisualStudio" Version="$(MicroBuildVersion)" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Test()
Project? project = solution.GetProject(projectId);
var parseOptions = (VisualBasicParseOptions)project!.ParseOptions!;
project = project.WithParseOptions(parseOptions.WithLanguageVersion(LanguageVersion.VisualBasic16));
project = project.WithParseOptions(parseOptions.WithLanguageVersion(LanguageVersion.VisualBasic15_5));
if (this.HasEntryPoint)
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PackageReference Include="MicroBuild.VisualStudio" Version="$(MicroBuildVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.0.1-beta1.20209.1" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.XUnit" Version="1.0.1-beta1.20209.1" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.8.2" />
<PackageReference Include="Microsoft.VisualStudio.OLE.Interop" Version="7.10.6070" />
<PackageReference Include="Microsoft.VisualStudio.Shell.14.0" Version="14.3.25407" IncludeAssets="runtime" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.11.0" Version="11.0.61030" IncludeAssets="runtime" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,27 @@ class Test
{
public Task<object> GetTaskObj()
{
return null;
return [|null|];
}
}
";
await new VerifyCS.Test
{
TestCode = csharpTest,
ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(8, 16, 8, 20), },
}.RunAsync();

var vbTest = @"
Imports System.Threading.Tasks
Friend Class Test
Public Function GetTaskObj() As Task(Of Object)
Return Nothing
Return [|Nothing|]
End Function
End Class
";
await new VerifyVB.Test
{
TestCode = vbTest,
ExpectedDiagnostics = { VerifyVB.Diagnostic().WithSpan(6, 16, 6, 32), },
}.RunAsync();
}

Expand Down Expand Up @@ -194,105 +192,5 @@ public Task<object> GetTaskObj(string s)
TestCode = test,
}.RunAsync();
}

[Fact]
public async Task NullableEnablePragmaBeforeClass_NoDiagnostic()
{
var test = @"
using System.Threading.Tasks;
#nullable enable
class Test
{
public Task<object> GetTaskObj(string s)
{
return null;
}
}
";
await new VerifyCS.Test
{
TestCode = test,
SolutionTransforms =
{
(solution, projectId) =>
{
var project = solution.GetProject(projectId);
var parseOptions = (CSharpParseOptions)project!.ParseOptions!;
return project.WithParseOptions(parseOptions.WithLanguageVersion(LanguageVersion.CSharp8)).Solution;
},
},
}.RunAsync();
}

[Fact]
public async Task NullableEnablePragmaBeforeMethod_NoDiagnostic()
{
var test = @"
using System.Threading.Tasks;
class Test
{
#nullable enable
public Task<object> GetTaskObj(string s)
{
return null;
}
}
";
await new VerifyCS.Test
{
TestCode = test,
SolutionTransforms =
{
(solution, projectId) =>
{
var project = solution.GetProject(projectId);
var parseOptions = (CSharpParseOptions)project!.ParseOptions!;
return project.WithParseOptions(parseOptions.WithLanguageVersion(LanguageVersion.CSharp8)).Solution;
},
},
}.RunAsync();
}

[Fact]
public async Task NullableEnablePragmaBeforeOnlySomeReturns_Diagnostic()
{
var test = @"
using System.Threading.Tasks;
class Test
{
public Task<object> GetTaskObj(string s)
{
if (string.IsNullOrEmpty(s))
{
return [|null|];
}
#nullable enable
return null;
}
}
";
await new VerifyCS.Test
{
TestCode = test,
SolutionTransforms =
{
(solution, projectId) =>
{
var project = solution.GetProject(projectId);
var parseOptions = (CSharpParseOptions)project!.ParseOptions!;
return project.WithParseOptions(parseOptions.WithLanguageVersion(LanguageVersion.CSharp8)).Solution;
},
},
}.RunAsync();
}
}
}

This file was deleted.

Loading

0 comments on commit a1d1d41

Please sign in to comment.