public void CompileAndExecuteGetDotNetType() { Block block; block = new Block(); block.CompileGetDotNetType("System.IO.FileInfo"); block.CompileByteCode(ByteCode.ReturnPop); object obj = block.Execute(null, null); Assert.IsNotNull(obj); Assert.IsInstanceOfType(obj, typeof(System.Type)); }
public void CompileAndRun() { Machine machine = new Machine(); Block block; block = new Block(); block.CompileArgument("newX"); block.CompileGet("newX"); block.CompileSet("GlobalX"); block.Execute(machine, new object[] { 10 }); Assert.AreEqual(10, machine.GetGlobalObject("GlobalX")); }
public void CompileAndExecuteNewDotNetObject() { Block block; block = new Block(); block.CompileGetDotNetType("System.IO.FileInfo"); block.CompileGetConstant("FooBar.txt"); block.CompileSend("!new:"); block.CompileByteCode(ByteCode.ReturnPop); object obj = block.Execute(null, null); Assert.IsNotNull(obj); Assert.IsInstanceOfType(obj, typeof(System.IO.FileInfo)); }
public void ExecuteEmptyBlock() { Block block; block = new Block(); object obj = block.Execute((Machine)null, null); Assert.IsNull(obj); }
public void CompileAndRunWithGlobal() { Block block; block = new Block(); block.CompileGetConstant(10); block.CompileSet("Global"); Machine machine = new Machine(); block.Execute(machine, null); Assert.AreEqual(10, machine.GetGlobalObject("Global")); }