fsunit

FsUnit `should equal` fails on `Some []`

社会主义新天地 提交于 2019-12-01 19:53:31
When I run this FsUnit test with NUnit 2.6.3, let f xs = Some (List.map ((+) 2) xs) [<Test>] let test() = f [] |> should equal (Some []) I get: Result Message: Expected: <Some([])> But was: <Some([])> Result StackTrace: at FsUnit.TopLevelOperators.should[a,a](FSharpFunc`2 f, a x, Object y) The test fails even though the Expected and Actual in the message are the same. What happened? pad The reason is that FsUnit uses untyped mechanism under the hood so Expected is inferred as object by the type checker (see the Object y part in the stacktrace). A workaround is to add type annotation for

Visual Studio FsUnit test setup - Exception NUnit.Engine.NUnitEngineException

為{幸葍}努か 提交于 2019-12-01 11:24:12
I am using Visual Studio 2013, installed FsUnit 2.2.0, which requires NUnit 3.2.1 and FSharpCore 3.1. I created a separate test project and put a testfixture and test in there. My platform is x64 Win 10. The config is for 'AnyCPU' and 'Debug'. I've tried test settings for x86 and x64. When trying to build and create tests, I get: ------ Discover test started ------ NUnit Adapter 3.2.0.0: Test discovery starting Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\Users\Dad\Documents\Visual Studio 2013\Projects\... Cannot run tests in process - a 32 bit process

What unit testing frameworks are available for F#

浪子不回头ぞ 提交于 2019-11-27 04:16:24
I am looking specifically for frameworks that allow me to take advantage of unique features of the language. I am aware of FsUnit . Would you recommend something else, and why? My own unit testing library, Unquote , takes advantage of F# quotations to allow you to write test assertions as plain, statically checked F# boolean expressions and automatically produces nice step-by-step test failure messages. For example, the following failing xUnit test [<Fact>] let ``demo Unquote xUnit support`` () = test <@ ([3; 2; 1; 0] |> List.map ((+) 1)) = [1 + 3..1 + 0] @> produces the following failure

What unit testing frameworks are available for F#

笑着哭i 提交于 2019-11-26 12:43:44
问题 I am looking specifically for frameworks that allow me to take advantage of unique features of the language. I am aware of FsUnit. Would you recommend something else, and why? 回答1: My own unit testing library, Unquote, takes advantage of F# quotations to allow you to write test assertions as plain, statically checked F# boolean expressions and automatically produces nice step-by-step test failure messages. For example, the following failing xUnit test [<Fact>] let ``demo Unquote xUnit support