[TestMethod] public void FinalizeLua() { GcUtil.NewTest(() => new Lua()).Kill(); #if DEBUG Assert.AreEqual(1u, Lua.PopLeakCount()); #endif }
[TestMethod] public void FinalizeLuaTable() { using (var lua = new Lua()) { GcUtil.NewTest(() => lua.NewTable()).Kill(); Assert.AreEqual(1, lua.CleanLeaks()); #if DEBUG Assert.AreEqual(1u, Lua.PopLeakCount()); #endif } }
[TestMethod] public void ClrInLua() { using (var lua = new Lua()) { var test = GcUtil.NewTest(() => { var o = new object(); lua["o"] = o; Assert.AreEqual(o, lua["o"]); return(o); }); GcUtil.GcAll(); test.AssertAlive(); lua["o"] = null; lua.CollectGarbage(); GcUtil.GcAll(); test.AssertDead(); } }