Exemple #1
0
        public void VisitLibrary_SavesFunctionNamesInEnv()
        {
            var env = new LispEnv();

            env.VisitLibrary(new SimpleTestCoreLibrary());

            var data = env.Copy();

            Assert.Contains("a", data.CoreFunctionNames);
            Assert.Contains("b", data.CoreFunctionNames);
            Assert.Contains("c", data.CoreFunctionNames);
        }
Exemple #2
0
        public void Eval_Defines_ValueReferenced()
        {
            var env   = new LispEnv();
            var name  = new AstSymbol("x");
            var value = new AstIntNumber(42);

            env.Eval(new AstList(
                         new AstSymbol("def!"),
                         name,
                         value));
            var data = env.Copy();

            Assert.Equal(value, data.Defines[name]);
        }