Commit 26775782 authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

[tests] Added test regressions for #78 Coroutine NRE.

parent 2cab813f
......@@ -1860,5 +1860,25 @@ namespace NLuaTest
}
}
[Test]
public void TestCoroutine ()
{
using (Lua lua = new Lua ()) {
lua.LoadCLRPackage ();
lua.RegisterFunction ("func1", null, typeof (TestClass2).GetMethod ("func"));
lua.DoString ("function yielder() " +
"a=1;" + "coroutine.yield();" +
"func1(3,2);" + "coroutine.yield();" + // This line triggers System.NullReferenceException
"a=2;" + "coroutine.yield();" +
"end;" +
"co_routine = coroutine.create(yielder);" +
"while coroutine.resume(co_routine) do end;");
double num = lua.GetNumber ("a");
//Console.WriteLine("a="+num);
Assert.AreEqual (num, 2d);
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment