Created
April 12, 2012 12:09
-
-
Save stephen-swensen/2366849 to your computer and use it in GitHub Desktop.
Demonstrate asserting a function returns Some using Unquote
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
//here is the function we'd like to test | |
let testedFunc() = None:option<int> | |
//here is our Unquote assertion function (using xUnit.net, but can use any unit testing framework such as NUnit) | |
[<Fact>] | |
let ``tested func does not return None`` () = | |
test <@ testedFunc() |> Option.isSome @> | |
//here is the output from the failing assertion | |
(* | |
Test 'TestModule.tested func does not return None' failed: | |
testedFunc() |> Option.isSome | |
None |> Option.isSome | |
false | |
C:\TestModule.fs(964,0): at TestModule.tested func does not return None() | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment