Example #1
0
        public void ExternalObjects()
        {
            var context = new JsContext();

            context.Set("console", new ConsoleTest());
            context.Run("console.log('teste')");

            //context.Set("$ERROR", );
            context.Set("script", new EvalTest(context));
            context.Run("function eval(code){ return script.eval(code); }");

            var r = context.Run("eval('1+1')");

            Assert.AreEqual(2, r);
        }
Example #2
0
        public void Test1()
        {
            var code = "function print(msg){ console.log(msg) } print('teste');";

            var context = new JsContext();
            context.Set("console", new ConsoleTest());
            var o = context.Run(code);
        }
Example #3
0
 public void Setup()
 {
     Context = new JsContext();
     Context.Set("___testUtil", new TestUtil());
     Context.Run("function $ERROR(message){ return ___testUtil.ThrowError(message); }");
 }