Пример #1
0
 [TestMethod] public void FinalizeLua()
 {
     GcUtil.NewTest(() => new Lua()).Kill();
                 #if DEBUG
     Assert.AreEqual(1u, Lua.PopLeakCount());
                 #endif
 }
Пример #2
0
 [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
     }
 }
Пример #3
0
        [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();
            }
        }