From f8f8fbf672c41a48da46a7472440986443c88d96 Mon Sep 17 00:00:00 2001 From: Frank Behrens Date: Mon, 12 Dec 2016 13:34:02 +0100 Subject: [PATCH 1/3] Add new project VerifyExpectoSupport --- Unquote.sln | 15 +++ VerifyExpectoSupport/App.config | 14 +++ VerifyExpectoSupport/Program.fs | 12 +++ .../VerifyExpectoSupport.fsproj | 97 +++++++++++++++++++ VerifyExpectoSupport/packages.config | 5 + 5 files changed, 143 insertions(+) create mode 100644 VerifyExpectoSupport/App.config create mode 100644 VerifyExpectoSupport/Program.fs create mode 100644 VerifyExpectoSupport/VerifyExpectoSupport.fsproj create mode 100644 VerifyExpectoSupport/packages.config diff --git a/Unquote.sln b/Unquote.sln index 6c0e3f7..e4fd543 100644 --- a/Unquote.sln +++ b/Unquote.sln @@ -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 @@ -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 @@ -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 diff --git a/VerifyExpectoSupport/App.config b/VerifyExpectoSupport/App.config new file mode 100644 index 0000000..a338d00 --- /dev/null +++ b/VerifyExpectoSupport/App.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/VerifyExpectoSupport/Program.fs b/VerifyExpectoSupport/Program.fs new file mode 100644 index 0000000..12db02c --- /dev/null +++ b/VerifyExpectoSupport/Program.fs @@ -0,0 +1,12 @@ +module Test.Swensen.Unquote.VerifyExpectoSupport + +open Expecto +open Swensen.Unquote + +[] +let expectoTests = testCase "test expecto support, this should fail with clean stack trace" <| fun _ -> test <@ 22 + 2 = 5 @> + +[] +let main args = + let result = runTestsInAssembly defaultConfig args + result \ No newline at end of file diff --git a/VerifyExpectoSupport/VerifyExpectoSupport.fsproj b/VerifyExpectoSupport/VerifyExpectoSupport.fsproj new file mode 100644 index 0000000..607b79f --- /dev/null +++ b/VerifyExpectoSupport/VerifyExpectoSupport.fsproj @@ -0,0 +1,97 @@ + + + + + Debug + AnyCPU + 2.0 + {9ab5c385-780b-4883-840c-59aa667ef5fa} + Exe + VerifyFuchuSupport + VerifyExpectoSupport + v4.5 + true + 4.3.1.0 + VerifyFuchuSupport + ..\ + true + + + true + full + false + false + bin\Debug\ + DEBUG;TRACE + 3 + AnyCPU + bin\Debug\VerifyExpectoSupport.XML + true + + + pdbonly + true + true + bin\Release\ + TRACE + 3 + AnyCPU + bin\Release\VerifyFuchuSupport.XML + true + + + 11 + + + + + $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets + + + + + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets + + + + + + + + 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}. + + + + + + + + + + + ..\packages\Argu.3.2.0\lib\net40\Argu.dll + + + ..\packages\Expecto.1.1.2\lib\net40\Expecto.dll + + + + True + + + + + + Unquote + {80f427b5-3aed-4d52-bc86-850a40427ecf} + True + + + + \ No newline at end of file diff --git a/VerifyExpectoSupport/packages.config b/VerifyExpectoSupport/packages.config new file mode 100644 index 0000000..07e5e3d --- /dev/null +++ b/VerifyExpectoSupport/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From 13c24f1247c7d176a704ec9026f1fb37508a76a0 Mon Sep 17 00:00:00 2001 From: Frank Behrens Date: Mon, 12 Dec 2016 15:10:35 +0100 Subject: [PATCH 2/3] Add Expecto Integration --- Unquote/Assertions.fs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Unquote/Assertions.fs b/Unquote/Assertions.fs index c3b92f8..4bd3f74 100644 --- a/Unquote/Assertions.fs +++ b/Unquote/Assertions.fs @@ -40,6 +40,7 @@ module Internal = | Xunit of Type | Nunit of Type | Fuchu of Type + | Expecto of Type | Fsi | Generic @@ -82,6 +83,8 @@ 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 Fuchu (Type.GetType("Expecto.AssertException, Expecto")) else yield Fsi @@ -89,6 +92,10 @@ module Internal = 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 @@ -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 -> From aa2b8103f2c7fa53eb3b8dab1902dcac66eaafff Mon Sep 17 00:00:00 2001 From: Frank Behrens Date: Tue, 13 Dec 2016 08:07:08 +0100 Subject: [PATCH 3/3] Fix Expecto reference --- Unquote/Assertions.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Unquote/Assertions.fs b/Unquote/Assertions.fs index 4bd3f74..54cd3c6 100644 --- a/Unquote/Assertions.fs +++ b/Unquote/Assertions.fs @@ -84,7 +84,7 @@ module Internal = 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 Fuchu (Type.GetType("Expecto.AssertException, Expecto")) + yield Expecto (Type.GetType("Expecto.AssertException, Expecto")) else yield Fsi