Skip to content

Commit

Permalink
added tests for CheckForOverflowUnderflow
Browse files Browse the repository at this point in the history
  • Loading branch information
filipw committed Aug 18, 2019
1 parent f0553de commit 21a0166
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static ProjectData Create(MSB.Evaluation.Project project)

var languageVersion = PropertyConverter.ToLanguageVersion(project.GetPropertyValue(PropertyNames.LangVersion));
var allowUnsafeCode = PropertyConverter.ToBoolean(project.GetPropertyValue(PropertyNames.AllowUnsafeBlocks), defaultValue: false);
var checkForOverflowUnderflow = PropertyConverter.ToBoolean(project.GetPropertyValue(PropertyNames.AllowUnsafeBlocks), defaultValue: false);
var checkForOverflowUnderflow = PropertyConverter.ToBoolean(project.GetPropertyValue(PropertyNames.CheckForOverflowUnderflow), defaultValue: false);
var outputKind = PropertyConverter.ToOutputKind(project.GetPropertyValue(PropertyNames.OutputType));
var nullableContextOptions = PropertyConverter.ToNullableContextOptions(project.GetPropertyValue(PropertyNames.Nullable));
var documentationFile = project.GetPropertyValue(PropertyNames.DocumentationFile);
Expand Down Expand Up @@ -228,7 +228,7 @@ public static ProjectData Create(MSB.Execution.ProjectInstance projectInstance)

var languageVersion = PropertyConverter.ToLanguageVersion(projectInstance.GetPropertyValue(PropertyNames.LangVersion));
var allowUnsafeCode = PropertyConverter.ToBoolean(projectInstance.GetPropertyValue(PropertyNames.AllowUnsafeBlocks), defaultValue: false);
var checkForOverflowUnderflow = PropertyConverter.ToBoolean(project.GetPropertyValue(PropertyNames.AllowUnsafeBlocks), defaultValue: false);
var checkForOverflowUnderflow = PropertyConverter.ToBoolean(projectInstance.GetPropertyValue(PropertyNames.CheckForOverflowUnderflow), defaultValue: false);
var outputKind = PropertyConverter.ToOutputKind(projectInstance.GetPropertyValue(PropertyNames.OutputType));
var nullableContextOptions = PropertyConverter.ToNullableContextOptions(projectInstance.GetPropertyValue(PropertyNames.Nullable));
var documentationFile = projectInstance.GetPropertyValue(PropertyNames.DocumentationFile);
Expand Down
1 change: 1 addition & 0 deletions test-assets/test-projects/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>7.1</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
</PropertyGroup>

</Project>
5 changes: 5 additions & 0 deletions tests/OmniSharp.MSBuild.Tests/ProjectFileInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public async Task HelloWorld_has_correct_property_values()

var compilationOptions = projectFileInfo.CreateCompilationOptions();
Assert.Equal(ReportDiagnostic.Error, compilationOptions.GeneralDiagnosticOption);
Assert.True(compilationOptions.CheckOverflow);
}
}

Expand All @@ -86,6 +87,10 @@ public async Task HelloWorldSlim_has_correct_property_values()
Assert.Equal(3, projectFileInfo.SourceFiles.Length); // Program.cs, AssemblyInfo.cs, AssemblyAttributes.cs
Assert.Equal("Debug", projectFileInfo.Configuration);
Assert.Equal("AnyCPU", projectFileInfo.Platform);

var compilationOptions = projectFileInfo.CreateCompilationOptions();
Assert.Equal(ReportDiagnostic.Default, compilationOptions.GeneralDiagnosticOption);
Assert.False(compilationOptions.CheckOverflow);
}
}

Expand Down

0 comments on commit 21a0166

Please sign in to comment.