-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
227 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{43BA7E25-975B-4DF9-B274-EEF6C806C1D0}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>Fsdk.Tests</RootNamespace> | ||
<AssemblyName>Fsdk.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion> | ||
<TargetFSharpCoreVersion>4.7.0.0</TargetFSharpCoreVersion> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Name>Fsdk.Tests</Name> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<Tailcalls>false</Tailcalls> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<WarningLevel>3</WarningLevel> | ||
<DocumentationFile>bin\Debug\Fsdk.Tests.XML</DocumentationFile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<Tailcalls>true</Tailcalls> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<WarningLevel>3</WarningLevel> | ||
<DocumentationFile>bin\Release\Fsdk.Tests.XML</DocumentationFile> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DefineConstants>$(DefineConstants);LEGACY_FRAMEWORK</DefineConstants> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="mscorlib" /> | ||
<Reference Include="FSharp.Core"> | ||
<HintPath>..\..\packages\FSharp.Core.4.7.0\lib\net45\FSharp.Core.dll</HintPath> | ||
</Reference> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="FSharpUtil.fs" /> | ||
<Compile Include="AsyncExtensions.fs" /> | ||
<Compile Include="Program.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Fsdk\Fsdk-legacy.fsproj" /> | ||
</ItemGroup> | ||
<Import Project="..\CommonBuildProps-legacy.proj" /> | ||
<Import Condition="'$(FSharpTargetsPath)' != ''" Project="$(FSharpTargetsPath)" /> | ||
<Target Name="BeforeBuild"> | ||
<Message Condition="'$(FSharpTargetsPath)' == ''" Importance="High" Text="F# SDK path was not found!" /> | ||
</Target> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
namespace Fsdk.Tests | ||
|
||
module Program = | ||
|
||
[<EntryPoint>] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NUnit" version="2.6.4" targetFramework="net46" /> | ||
<package id="NUnitTestAdapter" version="2.1.1" targetFramework="net46" /> | ||
<package id="FSharp.Core" version="4.7.0" targetFramework="net461" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="FSharp.Core" version="5.0.0.0" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
open System | ||
open System.IO | ||
open System.Net | ||
open System.Linq | ||
open System.Diagnostics | ||
|
||
#load "../Fsdk/Misc.fs" | ||
#load "../Fsdk/Process.fs" | ||
#load "../Fsdk/Network.fs" | ||
#load "../Fsdk/Git.fs" | ||
|
||
open Fsdk | ||
open Fsdk.Process | ||
|
||
let ScriptsDir = __SOURCE_DIRECTORY__ |> DirectoryInfo | ||
let RootDir = Path.Combine(ScriptsDir.FullName, "..") |> DirectoryInfo | ||
let TestDir = Path.Combine(RootDir.FullName, "test") |> DirectoryInfo | ||
let NugetDir = Path.Combine(RootDir.FullName, ".nuget") |> DirectoryInfo | ||
let NugetExe = Path.Combine(NugetDir.FullName, "nuget.exe") |> FileInfo | ||
let NugetPackages = Path.Combine(RootDir.FullName, "packages") |> DirectoryInfo | ||
|
||
let NugetScriptsPackagesDir() = | ||
let dir = Path.Combine(NugetDir.FullName, "packages") |> DirectoryInfo | ||
|
||
if not dir.Exists then | ||
Directory.CreateDirectory dir.FullName |> ignore | ||
|
||
dir | ||
|
||
let MakeCheckCommand(commandName: string) = | ||
if not(Process.CommandWorksInShell commandName) then | ||
Console.Error.WriteLine( | ||
sprintf "%s not found, please install it first" commandName | ||
) | ||
|
||
Environment.Exit 1 | ||
|
||
let RunUnitTests() = | ||
Console.WriteLine "Running unit tests...\n" | ||
|
||
let testProjectName = "Fsdk.Tests" | ||
#if !LEGACY_FRAMEWORK | ||
let testTarget = | ||
Path.Combine( | ||
RootDir.FullName, | ||
testProjectName, | ||
testProjectName + ".fsproj" | ||
) | ||
|> FileInfo | ||
#else | ||
// so that we get file names in stack traces | ||
Environment.SetEnvironmentVariable("MONO_ENV_OPTIONS", "--debug") | ||
|
||
let testTarget = | ||
Path.Combine( | ||
RootDir.FullName, | ||
testProjectName, | ||
"bin", | ||
"Debug", | ||
testProjectName + ".dll" | ||
) | ||
|> FileInfo | ||
#endif | ||
|
||
if not testTarget.Exists then | ||
failwithf "File not found: %s" testTarget.FullName | ||
|
||
let runnerCommand = | ||
#if !LEGACY_FRAMEWORK | ||
{ | ||
Command = "dotnet" | ||
Arguments = "test " + testTarget.FullName | ||
} | ||
#else | ||
match Misc.GuessPlatform() with | ||
| Misc.Platform.Linux -> | ||
let nunitCommand = "nunit-console" | ||
MakeCheckCommand nunitCommand | ||
|
||
{ | ||
Command = nunitCommand | ||
Arguments = testTarget.FullName | ||
} | ||
| _ -> | ||
let nunitVersion = "2.7.1" | ||
let pkgOutputDir = NugetScriptsPackagesDir() | ||
|
||
Network.InstallNugetPackage | ||
NugetExe | ||
pkgOutputDir | ||
"NUnit.Runners" | ||
(Some nunitVersion) | ||
Echo.All | ||
|> ignore | ||
|
||
{ | ||
Command = | ||
Path.Combine( | ||
NugetScriptsPackagesDir().FullName, | ||
sprintf "NUnit.Runners.%s" nunitVersion, | ||
"tools", | ||
"nunit-console.exe" | ||
) | ||
Arguments = testTarget.FullName | ||
} | ||
#endif | ||
|
||
Process | ||
.Execute(runnerCommand, Echo.All) | ||
.UnwrapDefault() | ||
|> ignore | ||
|
||
RunUnitTests() |