Beispiel #1
0
        public void PrintLogHigherScopeTest()
        {
            InputContext     context = TestScaffold.ConstructContext();
            PrintReceiverLog logger  = new PrintReceiverLog();

            context.PrintChannel.Register(logger);

            TestScaffold.TestLines(
                lines: new List <string>()
            {
                "{ f:print('... no highly esteemed deed is commemorated here') }"
            },
                expected: new List <object>()
            {
                0,
            },
                context: context
                );

            Assert.IsTrue(logger.Logs.Count == 1);
            Assert.AreEqual(logger.Logs[0], "... no highly esteemed deed is commemorated here");
        }
Beispiel #2
0
        public void PrintLogVarTest()
        {
            InputContext     context = TestScaffold.ConstructContext();
            PrintReceiverLog logger  = new PrintReceiverLog();

            context.PrintChannel.Register(logger);

            TestScaffold.TestLines(
                lines: new List <string>()
            {
                "v:str := 'this place is not a place of honor' \r\n" +
                "f:print(v:str)"
            },
                expected: new List <object>()
            {
                0,
            },
                context: context
                );

            Assert.IsTrue(logger.Logs.Count == 1);
            Assert.AreEqual(logger.Logs[0], "this place is not a place of honor");
        }
Beispiel #3
0
        public void PrintLogInObjectTest()
        {
            InputContext     context = TestScaffold.ConstructContext();
            PrintReceiverLog logger  = new PrintReceiverLog();

            context.PrintChannel.Register(logger);

            TestScaffold.TestLines(
                lines: new List <string>()
            {
                "defn d:printer { f:init := { f:print('... nothing valued is here') } } \r\n" +
                "v:p := object anon d:printer ()\r\n" +
                "0.0"
            },
                expected: new List <object>()
            {
                0.0,
            },
                context: context
                );

            Assert.IsTrue(logger.Logs.Count == 1);
            Assert.AreEqual(logger.Logs[0], "... nothing valued is here");
        }
Beispiel #4
0
        public void PrintLogTest()
        {
            InputContext     context = TestScaffold.ConstructContext();
            PrintReceiverLog logger  = new PrintReceiverLog();

            context.PrintChannel.Register(logger);

            TestScaffold.TestLines(
                lines: new List <string>()
            {
                "f:print('this place is a message') \r\n" +
                "f:print('... and part of a system of messages')"
            },
                expected: new List <object>()
            {
                0,
            },
                context: context
                );

            Assert.IsTrue(logger.Logs.Count == 2);
            Assert.AreEqual(logger.Logs[0], "this place is a message");
            Assert.AreEqual(logger.Logs[1], "... and part of a system of messages");
        }