public void TestFactorialByReference()
{
var storyStr = @"
VAR result = 0
~ factorialByRef(result, 5)
{ result }
== function factorialByRef(ref r, n) ==
{ r == 0:
~ r = 1
}
{ n > 1:
~ r = r * n
~ factorialByRef(r, n-1)
}
~ return
";
Story story = CompileString(storyStr);
Assert.AreEqual("120\n", story.ContinueMaximally());
}