Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement Expecto Support #128

Merged
merged 3 commits into from
Jan 5, 2017
Merged
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
15 changes: 15 additions & 0 deletions Unquote.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "VerifyFuchuSupport", "Verif
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "VerifyNunit3Support", "VerifyNunit3Support\VerifyNunit3Support.fsproj", "{154CB55A-CBF7-42D6-83E9-B868B3A88A26}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "VerifyExpectoSupport", "VerifyExpectoSupport\VerifyExpectoSupport.fsproj", "{9AB5C385-780B-4883-840C-59AA667EF5FA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -158,6 +160,18 @@ Global
{154CB55A-CBF7-42D6-83E9-B868B3A88A26}.Release|Any CPU.Build.0 = Release|Any CPU
{154CB55A-CBF7-42D6-83E9-B868B3A88A26}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{154CB55A-CBF7-42D6-83E9-B868B3A88A26}.Release|x86.ActiveCfg = Release|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Debug|x86.ActiveCfg = Debug|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Debug|x86.Build.0 = Debug|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Release|Any CPU.Build.0 = Release|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Release|x86.ActiveCfg = Release|Any CPU
{9AB5C385-780B-4883-840C-59AA667EF5FA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -174,5 +188,6 @@ Global
{584E665F-6C3C-4E36-8197-33FC631605EC} = {6C77CA49-EACA-4B17-A67B-BBE2B6836640}
{627D7E41-5569-4964-9B57-0B8B6360F5D2} = {6C77CA49-EACA-4B17-A67B-BBE2B6836640}
{154CB55A-CBF7-42D6-83E9-B868B3A88A26} = {6C77CA49-EACA-4B17-A67B-BBE2B6836640}
{9AB5C385-780B-4883-840C-59AA667EF5FA} = {6C77CA49-EACA-4B17-A67B-BBE2B6836640}
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions Unquote/Assertions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module Internal =
| Xunit of Type
| Nunit of Type
| Fuchu of Type
| Expecto of Type
| Fsi
| Generic

Expand Down Expand Up @@ -82,13 +83,19 @@ module Internal =
//issue in vs 2010: http://stackoverflow.com/questions/2024036/strange-fsi-exe-behavior
if assemblies |> Seq.exists (fun a -> a.GetName().Name = "Fuchu") then
yield Fuchu (Type.GetType("Fuchu.AssertException, Fuchu"))
elif assemblies |> Seq.exists (fun a -> a.GetName().Name = "Expecto") then
yield Expecto (Type.GetType("Expecto.AssertException, Expecto"))
else
yield Fsi

let ty = Type.GetType("Fuchu.AssertException, Fuchu")
if ty <> null then
yield Fuchu ty

let ty = Type.GetType("Expecto.AssertException, Expecto")
if ty <> null then
yield Expecto ty

let ty = Type.GetType("Xunit.Assert, xunit") //xunit v1
if ty <> null then
yield Xunit ty
Expand All @@ -109,6 +116,8 @@ module Internal =
match framework with
| Fuchu ty ->
(fun (msg : string) -> raise (Activator.CreateInstance(ty, msg) :?> Exception)) |> outputReducedExprsMsg
| Expecto ty ->
(fun (msg : string) -> raise (Activator.CreateInstance(ty, msg) :?> Exception)) |> outputReducedExprsMsg
| Fsi ->
fsiTestFailed
| Xunit ty ->
Expand Down
14 changes: 14 additions & 0 deletions VerifyExpectoSupport/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
12 changes: 12 additions & 0 deletions VerifyExpectoSupport/Program.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Test.Swensen.Unquote.VerifyExpectoSupport

open Expecto
open Swensen.Unquote

[<Tests>]
let expectoTests = testCase "test expecto support, this should fail with clean stack trace" <| fun _ -> test <@ 22 + 2 = 5 @>

[<EntryPoint>]
let main args =
let result = runTestsInAssembly defaultConfig args
result
97 changes: 97 additions & 0 deletions VerifyExpectoSupport/VerifyExpectoSupport.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9ab5c385-780b-4883-840c-59aa667ef5fa}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>VerifyFuchuSupport</RootNamespace>
<AssemblyName>VerifyExpectoSupport</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion>
<Name>VerifyFuchuSupport</Name>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</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>
<PlatformTarget>AnyCPU</PlatformTarget>
<DocumentationFile>bin\Debug\VerifyExpectoSupport.XML</DocumentationFile>
<Prefer32Bit>true</Prefer32Bit>
</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>
<PlatformTarget>AnyCPU</PlatformTarget>
<DocumentationFile>bin\Release\VerifyFuchuSupport.XML</DocumentationFile>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '11.0'">
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<ItemGroup>
<Compile Include="Program.fs" />
<None Include="App.config" />
<Content Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="Argu">
<HintPath>..\packages\Argu.3.2.0\lib\net40\Argu.dll</HintPath>
</Reference>
<Reference Include="Expecto">
<HintPath>..\packages\Expecto.1.1.2\lib\net40\Expecto.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<ProjectReference Include="..\Unquote\Unquote.fsproj">
<Name>Unquote</Name>
<Project>{80f427b5-3aed-4d52-bc86-850a40427ecf}</Project>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<!-- 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>
5 changes: 5 additions & 0 deletions VerifyExpectoSupport/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Expecto" version="1.1.2" targetFramework="net45" />
<package id="Argu" version="3.2.0.0" targetFramework="net45" />
</packages>