public void TestFunctionPurityChecks()
{
CompileStringWithoutRuntime(@"
-> test
== test ==
~ myFunc()
= function myBadInnerFunc
Not allowed!
~ return
== function myFunc ==
Hello world
* a choice
* another choice
-
-> myFunc
= testStitch
This is a stitch
~ return
", testingErrors: true);
Assert.AreEqual(7, _errorMessages.Count);
Assert.IsTrue(_errorMessages[0].Contains("Return statements can only be used in knots that"));
Assert.IsTrue(_errorMessages[1].Contains("Functions cannot be stitches"));
Assert.IsTrue(_errorMessages[2].Contains("Functions may not contain stitches"));
Assert.IsTrue(_errorMessages[3].Contains("Functions may not contain diverts"));
Assert.IsTrue(_errorMessages[4].Contains("Functions may not contain choices"));
Assert.IsTrue(_errorMessages[5].Contains("Functions may not contain choices"));
Assert.IsTrue(_errorMessages[6].Contains("Return statements can only be used in knots that"));
}