Пример #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 DisposeLua()
 {
     GcUtil.ExecuteAndKill(() =>
     {
         var lua = new Lua();
         var gc  = new GcUtil.GCTest(lua);
         lua.Dispose();
         lua.Dispose();
         return(gc);
     });
 }
Пример #4
0
 [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);
     });
 }
Пример #5
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();
            }
        }
Пример #6
0
 [TestCleanup] public void Cleanup()
 {
     GcUtil.GcAll();
 }