Skip to content

Commit

Permalink
Update Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom committed Feb 13, 2018
1 parent d54c468 commit f4d3fb4
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ scripts/*.patch
/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.dll
/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.pdb
/tests/Xnet40-fsharpqa-suite-failures.log.*
/tests/fsharp/typeProviders/splitAssemblyTools/provider.dll
/tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.dll
/vsintegration/src/service/FsPkgs/FSharp.Project/FS/FSharp.ProjectSystem.FSharp.fsi
/vsintegration/src/service/FsPkgs/FSharp.Project/FS/ctofiles/
/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Utils.dll
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<EnableDefaultCompileItems Condition=" '$(EnableDefaultCompileItems)' == '' ">false</EnableDefaultCompileItems> <!--- Do not glob F# source files -->
<EnableDefaultNoneItems Condition=" '$(EnableDefaultNoneItems)' == '' ">false</EnableDefaultNoneItems>
<DefaultValueTuplePackageVersion>4.3.1</DefaultValueTuplePackageVersion>
<DefaultFSharpPackageVersion>4.3.3</DefaultFSharpPackageVersion>
<DefaultFSharpPackageVersion>4.3.4</DefaultFSharpPackageVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
37 changes: 30 additions & 7 deletions src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<PackProjectInputFile>$(MSBuildProjectFullPath)</PackProjectInputFile>
</PropertyGroup>

<PropertyGroup Condition=" '$(DisableImplicitSystemValueTupleReference)' != 'true' ">
<PropertyGroup>
<_FrameworkNeedsValueTupleReference Condition=" ('$(TargetFrameworkIdentifier)' == '.NETStandard' or '$(TargetFrameworkIdentifier)' == '.NETCoreApp') and !('$(_TargetFrameworkVersionWithoutV)' >= '2.0') ">true</_FrameworkNeedsValueTupleReference>
<_FrameworkNeedsValueTupleReference Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' and
('$(_TargetFrameworkVersionWithoutV)' == '4.0' or
('$(_TargetFrameworkVersionWithoutV)' == '' or
'$(_TargetFrameworkVersionWithoutV)' == '4.0' or
'$(_TargetFrameworkVersionWithoutV)' == '4.5' or
'$(_TargetFrameworkVersionWithoutV)' == '4.6' or
'$(_TargetFrameworkVersionWithoutV)' == '4.6.1' or
Expand All @@ -71,16 +72,38 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<Target Name="FSharpCorePackageReferences" BeforeTargets="CollectPackageReferences;">
<ItemGroup>
<FSharpCorePackages Include="@(PackageReference)" Condition=" '%(Identity)' == 'FSharp.Core' " />
<PackageReference Update="FSharp.Core" Version ="$(FSharpCoreImplicitPackageVersion)" Condition=" ( ('$(FSharpCoreImplicitPackageVersion)' != '') and ('$(DisableImplicitFSharpCoreReference)' != 'true') and (@(FSharpCorePackages->Count()) == 1) ) and ('%(PackageReference.DefaultInclude)' == 'true') " />
<PackageReference Remove="FSharp.Core" Condition=" ('$(DisableImplicitFSharpCoreReference)' == 'true' or @(FSharpCorePackages->Count()) &gt; 1) and ('%(PackageReference.DefaultInclude)' == 'true') " />
<PackageReference Update="FSharp.Core" Version="$(FSharpCoreImplicitPackageVersion)"
Condition=" ('%(PackageReference.Identity)' == 'FSharp.Core')
and ('%(PackageReference.Version)' == '$(DefaultFSharpPackageVersion)')
and ('%(PackageReference.DefaultInclude)' == 'true')
and ('$(DisableImplicitFSharpCoreReference)' != 'true')
and ('$(FSharpCoreImplicitPackageVersion)' != '')
and (@(FSharpCorePackages->Count()) == 1) " />
<PackageReference Remove="FSharp.Core"
Condition=" (('$(DisableImplicitFSharpCoreReference)' == 'true') or (@(FSharpCorePackages->Count()) &gt; 1))
and ('%(PackageReference.Identity)' == 'FSharp.Core')
and ('%(PackageReference.Version)' == '$(DefaultFSharpPackageVersion)')
and ('%(PackageReference.DefaultInclude)' == 'true') " />
</ItemGroup>
</Target>

<Target Name="ValueTuplePackageReferences" BeforeTargets="CollectPackageReferences;">
<Message Text="PackageReferences: ValueTuplePackageReferences start : @(PackageReference)" />
<ItemGroup>
<ValueTuplePackagesPackages Include="@(PackageReference)" Condition=" '%(Identity)' == 'System.ValueTuple' " />
<PackageReference Update="System.ValueTuple" Version="$(ValueTupleImplicitPackageVersion)" Condition=" ( ('$(ValueTupleImplicitPackageVersion)' == '') and ('$(DisableImplicitSystemValueTupleReference)' != 'true') and ('$(_FrameworkNeedsValueTupleReference)' == 'true') and (@(ValueTuplePackages->Count()) == 1) and ('%(PackageReference.DefaultInclude)' == 'true') ) " />
<PackageReference Remove="System.ValueTuple" Condition=" ( ('$(DisableImplicitSystemValueTupleReference)' != 'true') or ('$(_FrameworkNeedsValueTupleReference)' != 'true') or (@(ValueTuplePackages->Count()) &gt; 1) ) and ('%(PackageReference.DefaultInclude)' == 'true') " />
<ValueTuplePackages Include="@(PackageReference)" Condition=" '%(Identity)' == 'System.ValueTuple' " />
<PackageReference Update="System.ValueTuple" Version="$(ValueTupleImplicitPackageVersion)"
Condition=" ('%(PackageReference.Identity)' == 'System.ValueTuple')
and ('%(PackageReference.Version)' == '$(DefaultValueTuplePackageVersion)')
and ('%(PackageReference.DefaultInclude)' == 'true')
and ('$(ValueTupleImplicitPackageVersion)' != '')
and ('$(DisableImplicitSystemValueTupleReference)' != 'true')
and ('$(_FrameworkNeedsValueTupleReference)' == 'true')
and (@(ValueTuplePackages->Count()) == 1) " />
<PackageReference Remove="System.ValueTuple"
Condition=" ( ('$(DisableImplicitSystemValueTupleReference)' == 'true') or ('$(_FrameworkNeedsValueTupleReference)' != 'true') or (@(ValueTuplePackages->Count()) &gt; 1) )
and ('%(PackageReference.Identity)' == 'System.ValueTuple')
and ('%(PackageReference.Version)' == '$(DefaultValueTuplePackageVersion)')
and ('%(PackageReference.DefaultInclude)' == 'true') " />
</ItemGroup>
</Target>

Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<HintPath Condition="'$(TargetDotnetProfile)' == 'net40'">$(FsCheckLibDir)\net45\FsCheck.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple">
<HintPath>..\..\..\packages\System.ValueTuple.4.3.1\lib\portable-net40+sl4+win8+wp8\System.ValueTuple.dll</HintPath>
<HintPath>..\..\packages\System.ValueTuple.4.3.1\lib\portable-net40+sl4+win8+wp8\System.ValueTuple.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions tests/fsharp/SDKTests/tests/DefaultImplicitReferenceTest.proj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
<Import Project="Test.props" />

<!-- if no FSharp.Core is specified, ensure the default is present -->
<!-- if no System.ValueTuple is specified, ensure the default is present -->

<PropertyGroup>
<ExpectsFSharpCore>true</ExpectsFSharpCore>
<ExpectedFSharpCorePackageVersion>$(DefaultFSharpPackageVersion)</ExpectedFSharpCorePackageVersion>

<ExpectsValueTuple>true</ExpectsValueTuple>
<ExpectedValueTuplePackageVersion>$(DefaultValueTuplePackageVersion)</ExpectedValueTuplePackageVersion>

</PropertyGroup>

<Import Project="Test.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
</PropertyGroup>

<!-- if $(DisableImplicitFSharpCoreReference) is set, ensure that FSharp.Core isn't present -->
<!-- if $(DisableImplicitValueTupleReference) is set, ensure that System.ValueTuple isn't present -->

<PropertyGroup>
<ExpectsFSharpCore>false</ExpectsFSharpCore>
<ExpectsValueTuple>false</ExpectsValueTuple>
</PropertyGroup>

<Import Project="Test.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@

<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FSharp.Core" Version="99.99.99" />
<PackageReference Include="System.ValueTuple" Version="44.44.44" />
</ItemGroup>

<!-- if $(DisableImplicitFSharpCoreReference) is set and an explicit PackageReference is added, that version of FSharp.Core is present -->
<!-- if $(DisableImplicitValueTupleReference) is set and an explicit PackageReference is added, that version of System.ValueTuple is present -->

<PropertyGroup>
<ExpectsFSharpCore>true</ExpectsFSharpCore>
<ExpectedFSharpCorePackageVersion>99.99.99</ExpectedFSharpCorePackageVersion>

<ExpectsValueTuple>true</ExpectsValueTuple>
<ExpectedValueTuplePackageVersion>44.44.44</ExpectedValueTuplePackageVersion>
</PropertyGroup>

<Import Project="Test.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@

<PropertyGroup>
<FSharpCoreImplicitPackageVersion>99.99.99</FSharpCoreImplicitPackageVersion>
<ValueTupleImplicitPackageVersion>44.44.44</ValueTupleImplicitPackageVersion>
</PropertyGroup>

<!-- if $(FSharpCoreImplicitPackgeVersion) is specified, ensure that's used -->
<!-- if $(ValueTupleImplicitPackageVersion) is specified, ensure that's used -->

<PropertyGroup>
<ExpectsFSharpCore>true</ExpectsFSharpCore>
<ExpectedFSharpCorePackageVersion>99.99.99</ExpectedFSharpCorePackageVersion>

<ExpectsValueTuple>true</ExpectsValueTuple>
<ExpectedValueTuplePackageVersion>44.44.44</ExpectedValueTuplePackageVersion>
</PropertyGroup>

<Import Project="Test.targets" />
Expand Down
1 change: 1 addition & 0 deletions tests/fsharp/SDKTests/tests/Test.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<TargetFramework Condition="'$(TargetFramework)' == ''">net46</TargetFramework>
<Configuration Condition="'$(Configuration)' == ''">release</Configuration>
<BinariesDirectory>$(MSBuildThisFileDirectory)..\..\..\..\$(Configuration)\net40\bin</BinariesDirectory>

Expand Down
16 changes: 15 additions & 1 deletion tests/fsharp/SDKTests/tests/Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

<Import Project="$(BinariesDirectory)\Microsoft.FSharp.NetSdk.targets" />

<Target Name="Test" DependsOnTargets="FSharpCorePackageReferences">
<Target Name="Test" DependsOnTargets="FSharpCorePackageReferences;ValueTuplePackageReferences">

<Message Importance="High" Text="Testing : $(MSBuildProjectName)" />
<ItemGroup>
<FoundFSharpCorePackages Include="@(PackageReference)" Condition="'%(Identity)' == 'FSharp.Core'" />
<FoundValueTuplePackages Include="@(PackageReference)" Condition="'%(Identity)' == 'System.ValueTuple'" />
</ItemGroup>

<Message Importance="High" Text="Diagnostic TestTarget PackageReference = '@(PackageReference)' " />
<Message Importance="High" Text="Diagnostic TestTarget FoundFSharpCorePackages = '@(FoundFSharpCorePackages)' " />
<Message Importance="High" Text="Diagnostic TestTarget FoundValueTuplePackages = '@(FoundValueTuplePackages)' " />

<!-- check for invalid test settings -->
<Error Condition="'$(ExpectsFSharpCore)' != 'true' and '$(ExpectedFSharpCorePackageVersion)' != ''" Text="A test cannot specify both ExepctsFSharpCore=false and provide a value for ExpectedFSharpCorePackageVersion." />

Expand All @@ -16,9 +22,17 @@
<Error Condition="'$(ExpectsFSharpCore)' != 'true' and @(FoundFSharpCorePackages->Count()) &gt; 0" Text="Expected no FSharp.Core to be present, but found version %(FoundFSharpCorePackages.Version)." />
<Error Condition="@(FoundFSharpCorePackages->Count()) &gt; 1" Text="Found more than one version of FSharp.Core; this should never happen: version=%(FoundFSharpCorePackages.Version)." />

<!-- validate there is only ever 0 or 1 System.ValueTuple present -->
<Error Condition="'$(ExpectsValueTuple)' == 'true' and @(FoundValueTuplePackages->Count()) == 0" Text="No System.ValueTuple reference found. Expected version $(ExpectedValueTuplePackageVersion)." />
<Error Condition="'$(ExpectsValueTuple)' != 'true' and @(FoundValueTuplePackages->Count()) &gt; 0" Text="Expected no System.ValueTuple to be present, but found version %(FoundValueTuplePackages.Version)." />
<Error Condition="@(FoundValueTuplePackages->Count()) &gt; 1" Text="Found more than one version of ValueTuple; this should never happen: version=%(FoundValueTuplePackages.Version)." />


<!-- validate the version of the listed FSharp.Core -->
<Error Condition="'$(ExpectsFSharpCore)' == 'true' and '%(FoundFSharpCorePackages.Version)' != '$(ExpectedFSharpCorePackageVersion)'" Text="Expected FSharp.Core version $(ExpectedFSharpCorePackageVersion) but found %(FoundFSharpCorePackages.Version)." />

<!-- validate the version of the listed System.ValueTuple -->
<Error Condition="'$(ExpectsValueTuple)' == 'true' and '%(FoundValueTuplePackages.Version)' != '$(ExpectedValueTuplePackageVersion)'" Text="Expected System.ValueTuple version $(ExpectedValueTuplePackageVersion) but found %(FoundValueTuplePackages.Version)." />
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="99.99.99" />
<PackageReference Update="System.ValueTuple" Version="44.44.44" />
</ItemGroup>

<!-- honor updating the reference; this is what the NuGet package manager in Visual Studio does -->

<PropertyGroup>
<ExpectsFSharpCore>true</ExpectsFSharpCore>
<ExpectedFSharpCorePackageVersion>99.99.99</ExpectedFSharpCorePackageVersion>
<ExpectsValueTuple>true</ExpectsValueTuple>
<ExpectedValueTuplePackageVersion>44.44.44</ExpectedValueTuplePackageVersion>
</PropertyGroup>

<Import Project="Test.targets" />
Expand Down

0 comments on commit f4d3fb4

Please sign in to comment.