[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 DisposeLua() { GcUtil.ExecuteAndKill(() => { var lua = new Lua(); var gc = new GcUtil.GCTest(lua); lua.Dispose(); lua.Dispose(); return(gc); }); }
[TestMethod] public void DisposeLuaTableAfterLua() { GcUtil.ExecuteAndKill(() => { var lua = new Lua(); var table = lua.NewTable(); var gc = new GcUtil.GCTest(table); lua.Dispose(); lua.Dispose(); table.Dispose(); table.Dispose(); return(gc); }); }
[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(); } }
[TestCleanup] public void Cleanup() { GcUtil.GcAll(); }