SwensenSoftware / unquote

Write F# unit test assertions as quoted expressions, get step-by-step failure messages for free
http://www.swensensoftware.com/unquote
Apache License 2.0
285 stars 26 forks source link

Error while evaluating internal scoped discriminated union #123

Closed VTJDailey closed 8 years ago

VTJDailey commented 8 years ago
            module internal submodule =
                type TTEST = 
                | TTEST1
                | TTEST2

            [<Fact>]
            let ``performtest`` () =
                test <@ submodule.TTEST1 = submodule.TTEST1 @>

This throws a KeyNotFoundException. Removing the internal modifier to submodule allows the test to run as expected : Result Message: TTEST1 = TTEST1 System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at Microsoft.FSharp.Collections.MapTreeModule.find[TValue,a](IComparer1 comparer, TValue k, MapTree2 m) at Microsoft.FSharp.Reflection.Impl.getUnionTagConverter@455-2.Invoke(Int32 tag) at Microsoft.FSharp.Reflection.Impl.getUnionCaseConstructorMethod(Type typ, Int32 tag, BindingFlags bindingFlags) at Microsoft.FSharp.Reflection.Impl.getUnionCaseConstructor(Type typ, Int32 tag, BindingFlags bindingFlags) at Microsoft.FSharp.Reflection.FSharpValue.MakeUnion(UnionCaseInfo unionCase, Object[] args, FSharpOption1 bindingFlags) at Microsoft.FSharp.Collections.IEnumerator.map@111.DoMoveNext(b& ) at Microsoft.FSharp.Collections.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable1 source) at Swensen.Unquote.Evaluation.eval@146(FSharpList1 env, FSharpExpr expr) at Swensen.Unquote.Evaluation.eval(FSharpList1 env, FSharpExpr expr) at Swensen.Unquote.Evaluation.eval(FSharpList1 env, FSharpExpr expr) at Swensen.Unquote.Reduction.reduce(FSharpList1 env, FSharpExpr expr) at Swensen.Unquote.Reduction.loop@126(FSharpList1 env, FSharpExpr expr, FSharpList`1 acc)

Expected: True Actual: False

stephen-swensen commented 8 years ago

Hi @VTJDailey - this issue was actually fixed recently by #122. It hasn't been released yet, but you can preview the CI build: https://ci.appveyor.com/project/stephen-swensen/unquote/build/artifacts

Regards,

Stephen

VTJDailey commented 8 years ago

Oh, wonderful, thanks!