Skip to content

Instantly share code, notes, and snippets.

@bpatra
Last active December 20, 2015 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bpatra/6098656 to your computer and use it in GitHub Desktop.
Save bpatra/6098656 to your computer and use it in GitHub Desktop.
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