Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
NLua
Commits
26775782
Commit
26775782
authored
Apr 07, 2014
by
Vinicius Jarina
Browse files
[tests] Added test regressions for #78 Coroutine NRE.
parent
2cab813f
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/LuaTests.cs
View file @
26775782
...
...
@@ -1858,6 +1858,26 @@ namespace NLuaTest
Assert
.
AreEqual
(
LuaTests
.
UnicodeString
,
res
);
}
}
[
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
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment