Created
September 23, 2016 13:32
-
-
Save robkuz/d5fe39e7e9ccfb0f73abc00a94aee70c to your computer and use it in GitHub Desktop.
Checking if DU Value constructors are "reflected" in the same order of definition
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
//I'd like to see if the test below is true on different execution environments and compilers | |
//so if you could please run this code and report back to me at @kuzrob. Thanks | |
open Microsoft.FSharp.Reflection | |
type SomeDU<'a,'b, 'c> = | |
| One of 'a | |
| Two of 'a * 'b | |
| Three of 'a * 'b * 'c | |
[<Test>] | |
let ``is the order correct?`` () = | |
let result = FSharpType.GetUnionCases typeof<SomeDU<_,_,_>> |> Array.map (fun case -> case.Name) | |
printfn "isTrue: %A" ([|"One"; "Two"; "Three"|] = result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment