Instantly share code, notes, and snippets.

@bpatra /gist:6098656
Last active Dec 20, 2015

Embed
What would you like to do?
F#ception. test execution with factorial
[<TestClass>]
type FsCeptionTests () =
[<TestMethod>]
member this.WithFactorial () =
let myTest = "module dafuq
let rec factorial n =
match n with
| 0 -> 1
| 1 -> 1
| _ -> n*factorial(n-1)
let x= factorial 5
"
let codDomPath = @"<yourPath>\FSharp.Compiler.CodeDom.dll"
let psCode = FsToPs codDomPath myTest "dafuq" "x"
let result = ExecPsScript<int> psCode
Assert.AreEqual(120,result)
()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment