Tests.Tests.TestEndOfContent C# (CSharp) Method

TestEndOfContent() private method

private TestEndOfContent ( ) : void
return void
        public void TestEndOfContent()
        {
            Story story = CompileString("Hello world", false, true);
            story.ContinueMaximally();
            Assert.IsFalse(HadError());

            story = CompileString("== test ==\nContent\n-> END");
            story.ContinueMaximally();
            Assert.IsFalse(story.hasError);

            // Should have runtime error due to running out of content
            // (needs a -> END)
            story = CompileString("== test ==\nContent", false, true);
            story.ContinueMaximally();
            Assert.IsTrue(HadWarning());

            // Should have warning that there's no "-> END"
            CompileStringWithoutRuntime("== test ==\nContent", true);
            Assert.IsFalse(HadError());
            Assert.IsTrue(HadWarning());

            CompileStringWithoutRuntime("== test ==\n~return", testingErrors: true);
            Assert.IsTrue(HadError("Return statements can only be used in knots that are declared as functions"));

            CompileStringWithoutRuntime("== function test ==\n-> END", testingErrors: true);
            Assert.IsTrue(HadError("Functions may not contain diverts"));
        }
Tests