Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion appveyor-build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=coreclr /p:Configuration=Release /p:RestorePackages=true
@if ERRORLEVEL 1 echo Error: library unittests build failed coreclr && goto :failure

REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable47 && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
Expand Down Expand Up @@ -103,6 +106,9 @@ call RunTests.cmd release coreunit
call RunTests.cmd release fsharp coreclr
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreclr' failed && goto :failure

call RunTests.cmd release coreunitcoreclr
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunit' failed && goto :failure

popd

goto :eof
Expand Down
12 changes: 11 additions & 1 deletion packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,14 @@
<package id="NUnit.Runners" version="2.6.4" />
<package id="FSharp.Data" version="2.2.5" />
<package id="FsCheck" version="2.0.3" />
</packages>
<package id="xunit" version="1.9.2" targetFramework="net4" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.console.netcore" version="1.0.2-prerelease-00115" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.console" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.dependencies.netcore" version="1.0.1-prerelease" />
<package id="xunit.runner.utility" version="2.1.0" />
</packages>
1 change: 1 addition & 0 deletions src/FSharpSource.targets
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<When Condition="'$(AssemblyName)' == 'FSharp.Core.Unittests'">
<PropertyGroup>
<OtherFlags>$(OtherFlags) --version:4.4.0.9055</OtherFlags>
<ExcludeSigningImport>true</ExcludeSigningImport>
</PropertyGroup>
</When>
<Otherwise>
Expand Down
65 changes: 52 additions & 13 deletions src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<!-- Prevent compiler from inlining calls to FSharp.Core to improve code coverage accuracy -->
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<TargetProfile Condition=" '$(TargetFramework)' == 'portable7' or '$(TargetFramework)' == 'portable78' or '$(TargetFramework)' == 'portable259' ">netcore</TargetProfile>
<TargetProfile Condition=" '$(TargetFramework)' == 'portable7' or '$(TargetFramework)' == 'portable78' or '$(TargetFramework)' == 'portable259' or '$(TargetFramework)' == 'coreclr' ">netcore</TargetProfile>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition=" '$(TargetFramework)' == 'sl5' ">$(DefineConstants);SILVERLIGHT</DefineConstants>
Expand All @@ -43,27 +43,64 @@
<WarningLevel>3</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- need full name and SpecificVersion = true in order to convince msbuild to allow this reference when targeting portable47 -->
<Reference Include="nunit.framework, Version=$(NUnitFullVersion), Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" Condition="'$(TargetFramework)' != 'sl5' AND '$(TargetFramework)' != 'sl3-wp'">
<SpecificVersion>true</SpecificVersion>
<Private>True</Private>
<HintPath>$(NUnitLibDir)\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="FsCheck, Version=$(FsCheckFullVersion)" Condition="'$(TargetFramework)' != 'portable47' AND '$(TargetFramework)' != 'net20'">
<SpecificVersion>true</SpecificVersion>
<Private>True</Private>
<HintPath Condition="'$(TargetFramework)' == 'net40'">$(FsCheckLibDir)\net45\FsCheck.dll</HintPath>
<HintPath Condition="'$(TargetFramework)' == 'portable7'">$(FsCheckLibDir)\portable-net45+netcore45\FsCheck.dll</HintPath>
<HintPath Condition="'$(TargetFramework)' == 'portable78'">$(FsCheckLibDir)\portable-net45+netcore45+wp8\FsCheck.dll</HintPath>
<HintPath Condition="'$(TargetFramework)' == 'portable259'">$(FsCheckLibDir)\portable-net45+netcore45+wpa81+wp8\FsCheck.dll</HintPath>
<HintPath Condition="'$(TargetFramework)' == 'portable259' OR '$(TargetFramework)' == 'coreclr'">$(FsCheckLibDir)\portable-net45+netcore45+wpa81+wp8\FsCheck.dll</HintPath>
</Reference>
<Reference Include="NUnitFramework" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'sl3-wp'" />
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
<Name>FSharp.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition="!$(TargetFramework.Contains('portable'))">
<ItemGroup Condition="'$(TargetFramework)' == 'portable47'">
<!-- need full name and SpecificVersion = true in order to convince msbuild to allow this reference when targeting portable47 -->
<Reference Include="xunit, Version=1.9.2.1705, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
<SpecificVersion>true</SpecificVersion>
<HintPath>..\..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'portable47'">
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
<SpecificVersion>true</SpecificVersion>
<Private>True</Private>
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\..\packages\xunit.extensibility.core.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.core.dll</HintPath>
</Reference>
<Reference Include="xunit.execution.desktop" Condition="'$(TargetFramework)' != 'coreclr'">
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'coreclr'">
<Reference Include="xunit.console.netcore">
<HintPath>..\..\..\packages\xunit.console.netcore.1.0.2-prerelease-00115\runtimes\any\native\xunit.console.netcore.exe</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.execution.dotnet">
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.execution.dotnet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.runner.utility">
<HintPath>..\..\..\packages\xunit.runner.dependencies.netcore.1.0.1-prerelease\lib\portable-wpa80+win8+net45+aspnetcore50\xunit.runner.utility.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.runner.utility.dotnet">
<HintPath>..\..\..\packages\xunit.runner.utility.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.runner.utility.dotnet.dll</HintPath>
<Private>True</Private>
</Reference>
<None Include="project.json" />
</ItemGroup>
<ItemGroup Condition="(!$(TargetFramework.Contains('portable'))) and '$(TargetFramework)' != 'coreclr'">
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Numerics" Condition="'$(TargetFramework)' == 'net40'" />
Expand All @@ -72,6 +109,7 @@
<Reference Include="System.Observable" Condition="'$(TargetFramework)' == 'sl3-wp' " />
</ItemGroup>
<ItemGroup>
<Compile Include="NUnitShim.fs" />
<Compile Include="LibraryTestFx.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\Utils.fs" Condition="'$(TargetFramework)' != 'portable47' AND '$(TargetFramework)' != 'net20'" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ArrayModule.fs" />
Expand All @@ -84,7 +122,7 @@
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\HashIdentityModule.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ListModule.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ListModule2.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ObsoleteListFunctions.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ObsoleteListFunctions.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ListType.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ListProperties.fs" Condition="'$(TargetFramework)' != 'portable47' AND '$(TargetFramework)' != 'net20'" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Collections\MapModule.fs" />
Expand All @@ -100,6 +138,7 @@
<Compile Include="FSharp.Core\PrimTypes.fs" />
<Compile Include="FSharp.Core\ComparersRegression.fs" />
<Compile Include="FSharp.Core\DiscrimantedUnionType.fs" />
<Compile Include="FSharp.Core\DiscrimantedUnionType.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Core\BigIntType.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Core\IntConversions.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Core\IntConversionsGenerated.fs" />
Expand All @@ -116,11 +155,11 @@
<Compile Include="FSharp.Core\Microsoft.FSharp.Reflection\FSharpReflection.fs" />
<Compile Include="FSharp.Core\Microsoft.FSharp.Quotations\FSharpQuotations.fs" />
<Compile Include="TypeForwarding.fs" />
<Compile Include="NUnitFrameworkShims.fs" Condition="'$(TargetFramework)' == 'sl3-wp'" />
<!--Compile Include="NUnitFrameworkShims.fs" Condition="'$(TargetFramework)' == 'sl3-wp'" /-->
<Compile Include="SurfaceArea.$(TargetFramework).fs" />
<CustomCopyLocal Include="FSharp.Core.Unittests.dll.config">
<TargetFilename>FSharp.Core.Unittests.dll.config</TargetFilename>
</CustomCopyLocal>
</ItemGroup>
</ItemGroup>
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ type ListModule() =

Assert.AreEqual([null], List.distinct [null])
let list = new System.Collections.Generic.List<int>()
Assert.AreEqual([null, list], List.distinct [null, list])
Assert.IsTrue([null, list] = List.distinct [null, list])

[<Test>]
member this.distinctBy() =
Expand All @@ -185,7 +185,7 @@ type ListModule() =

Assert.AreEqual([null], List.distinctBy id [null])
let list = new System.Collections.Generic.List<int>()
Assert.AreEqual([null, list], List.distinctBy id [null, list])
Assert.IsTrue([null, list] = List.distinctBy id [null, list])

[<Test>]
member this.Take() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ type AsyncModule() =
#if FSHARP_CORE_2_0
// nothing
#else
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
//nothing
#else
// we are on the desktop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type AsyncType() =
member this.CreateTask () =
let s = "Hello tasks!"
let a = async { return s }
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t : Task<string> =
#else
use t : Task<string> =
Expand All @@ -140,7 +140,7 @@ type AsyncType() =
member this.StartTask () =
let s = "Hello tasks!"
let a = async { return s }
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t =
#else
use t =
Expand All @@ -155,7 +155,7 @@ type AsyncType() =
let a = async {
do raise (Exception ())
}
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t =
#else
use t =
Expand All @@ -174,7 +174,7 @@ type AsyncType() =
let a = async {
while true do ()
}
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t =
#else
use t =
Expand All @@ -199,7 +199,7 @@ type AsyncType() =
}
let cts = new CancellationTokenSource()
let token = cts.Token
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t =
#else
use t =
Expand All @@ -221,7 +221,7 @@ type AsyncType() =
[<Test>]
member this.TaskAsyncValue () =
let s = "Test"
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t =
#else
use t =
Expand All @@ -235,7 +235,7 @@ type AsyncType() =

[<Test>]
member this.TaskAsyncValueException () =
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t =
#else
use t =
Expand All @@ -254,7 +254,7 @@ type AsyncType() =
use ewh = new ManualResetEvent(false)
let cts = new CancellationTokenSource()
let token = cts.Token
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t : Task<unit>=
#else
use t : Task<unit>=
Expand All @@ -273,7 +273,7 @@ type AsyncType() =
[<Test>]
member this.NonGenericTaskAsyncValue () =
let hasBeenCalled = ref false
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t =
#else
use t =
Expand All @@ -288,7 +288,7 @@ type AsyncType() =

[<Test>]
member this.NonGenericTaskAsyncValueException () =
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t =
#else
use t =
Expand All @@ -307,7 +307,7 @@ type AsyncType() =
use ewh = new ManualResetEvent(false)
let cts = new CancellationTokenSource()
let token = cts.Token
#if FSHARP_CORE_NETCORE_PORTABLE
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
let t =
#else
use t =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ type FSharpValueTests() =
member this.GetExceptionFields() =

// int
Assert.AreEqual(FSharpValue.GetExceptionFields(exInt),[|1|])
Assert.AreEqual(FSharpValue.GetExceptionFields(exInt), ([|1|] : obj []))

// dataless
Assert.AreEqual(FSharpValue.GetExceptionFields(exDataless),[||])
Expand Down Expand Up @@ -257,7 +257,7 @@ type FSharpValueTests() =
member this.GetUnionFields() =
// single case union
let (singlecaseinfo,singlevaluearray) = FSharpValue.GetUnionFields(singlecaseunion1,typeof<SingleCaseDiscUnion>)
Assert.AreEqual(singlevaluearray, [|1.0;2.0;3.0|])
Assert.AreEqual(singlevaluearray, ([|1.0;2.0;3.0|] : obj []))

// DiscUnionType
let (duCaseinfo, duValueArray) = FSharpValue.GetUnionFields(discUniontypeB,typeof<DiscUnionType<int>>)
Expand Down
10 changes: 5 additions & 5 deletions src/fsharp/FSharp.Core.Unittests/FSharp.Core/PrimTypes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ type LanguagePrimitivesModule() =

// null reference
let resultNul = LanguagePrimitives.GenericMaximum null null
Assert.AreEqual(null, resultNul)
Assert.IsNull(resultNul)

let resultNul = LanguagePrimitives.GenericMaximum null "ABCDE"
Assert.AreEqual("ABCDE", resultNul)
Expand All @@ -360,13 +360,13 @@ type LanguagePrimitivesModule() =

// null reference
let resultNul = LanguagePrimitives.GenericMinimum null null
Assert.AreEqual(null, resultNul)
Assert.IsNull(resultNul)

let resultNul = LanguagePrimitives.GenericMinimum null "ABC"
Assert.AreEqual(null, resultNul)
Assert.IsNull(resultNul)

let resultNul = LanguagePrimitives.GenericMinimum "ABC" null
Assert.AreEqual(null, resultNul)
Assert.IsNull(resultNul)

[<Test>]
member this.GenericOne() =
Expand Down Expand Up @@ -425,7 +425,7 @@ type LanguagePrimitivesModule() =
Assert.AreEqual(-100000000000000000L, resultValue)

let resultValue = LanguagePrimitives.ParseInt64 "0"
Assert.AreEqual(0, resultValue)
Assert.AreEqual(0L, resultValue)

CheckThrowsFormatException(fun () -> LanguagePrimitives.ParseInt64 "" |> ignore)

Expand Down
6 changes: 3 additions & 3 deletions src/fsharp/FSharp.Core.Unittests/LibraryTestFx.fs
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ module SurfaceArea =

// get current fsharp.core
let asm =
#if portable7 || portable78 || portable259
#if portable7 || portable78 || portable259 || coreclr
typeof<int list>.GetTypeInfo().Assembly
#else
typeof<int list>.Assembly
#endif

// public types only
let types =
#if portable7 || portable78 || portable259
#if portable7 || portable78 || portable259 || coreclr
asm.ExportedTypes |> Seq.filter (fun ty -> let ti = ty.GetTypeInfo() in ti.IsPublic || ti.IsNestedPublic) |> Array.ofSeq
#else
asm.GetExportedTypes()
Expand All @@ -96,7 +96,7 @@ module SurfaceArea =
// extract canonical string form for every public member of every type
let getTypeMemberStrings (t : Type) =
// for System.Runtime-based profiles, need to do lots of manual work
#if portable7 || portable78 || portable259
#if portable7 || portable78 || portable259 || coreclr
let getMembers (t : Type) =
let ti = t.GetTypeInfo()
let cast (info : #MemberInfo) = (t, info :> MemberInfo)
Expand Down
Loading