Commit be5ea9b0 authored by Eonstorm's avatar Eonstorm
Browse files

Corrected the ThrowException test to check the proper exception message.

Reference Issue 21.


git-svn-id: http://luainterface.googlecode.com/svn/trunk@16 63eb109e-e254-0410-a61e-ed0b8f8614f5
parent c5849187
...@@ -980,7 +980,11 @@ namespace LuaInterface.Tests ...@@ -980,7 +980,11 @@ namespace LuaInterface.Tests
bool err = (bool)_Lua["err"]; bool err = (bool)_Lua["err"];
Exception errMsg = (Exception)_Lua["errMsg"]; Exception errMsg = (Exception)_Lua["errMsg"];
TestOk(!err); TestOk(!err);
TestOk("exception test" == errMsg.Message); TestOk(errMsg.InnerException != null);
if (errMsg.InnerException != null)
{
TestOk("exception test" == errMsg.InnerException.Message);
}
//Console.WriteLine("interface returned: "+errMsg.ToString()); //Console.WriteLine("interface returned: "+errMsg.ToString());
Destroy(); Destroy();
...@@ -1077,7 +1081,7 @@ namespace LuaInterface.Tests ...@@ -1077,7 +1081,7 @@ namespace LuaInterface.Tests
for (int i = 0; i < 10000; i++) for (int i = 0; i < 10000; i++)
{ {
using (Lua lua = new Lua()) using (Lua lua = new Lua())
{ {
_Calc(lua, i); _Calc(lua, i);
} }
} }
...@@ -1124,7 +1128,7 @@ namespace LuaInterface.Tests ...@@ -1124,7 +1128,7 @@ namespace LuaInterface.Tests
{ {
_Lua.DoString("dowork()"); _Lua.DoString("dowork()");
} }
catch catch
{ {
failureDetected = true; failureDetected = true;
} }
...@@ -1136,7 +1140,7 @@ namespace LuaInterface.Tests ...@@ -1136,7 +1140,7 @@ namespace LuaInterface.Tests
Thread.Sleep(50); Thread.Sleep(50);
if (failureDetected) if (failureDetected)
Console.WriteLine("==Problem with threading!=="); Console.WriteLine("==Problem with threading!==");
} }
private void TestPrivateMethod() private void TestPrivateMethod()
...@@ -1294,7 +1298,7 @@ namespace LuaInterface.Tests ...@@ -1294,7 +1298,7 @@ namespace LuaInterface.Tests
{ {
_Lua.DoString("thiswillthrowanerror", "MyChunk"); _Lua.DoString("thiswillthrowanerror", "MyChunk");
} }
catch(Exception e) catch (Exception e)
{ {
if (e.Message.StartsWith("[string \"MyChunk\"]")) if (e.Message.StartsWith("[string \"MyChunk\"]"))
Console.WriteLine("Chunk overload passed"); Console.WriteLine("Chunk overload passed");
...@@ -1314,7 +1318,7 @@ namespace LuaInterface.Tests ...@@ -1314,7 +1318,7 @@ namespace LuaInterface.Tests
//_Lua.RegisterFunction("genericMethod", genericClass, typeof(TestClassGeneric<>).GetMethod("GenericMethod")); //_Lua.RegisterFunction("genericMethod", genericClass, typeof(TestClassGeneric<>).GetMethod("GenericMethod"));
//_Lua.RegisterFunction("regularMethod", genericClass, typeof(TestClassGeneric<>).GetMethod("RegularMethod")); //_Lua.RegisterFunction("regularMethod", genericClass, typeof(TestClassGeneric<>).GetMethod("RegularMethod"));
//try //try
//{ //{
// _Lua.DoString("genericMethod('thestring')"); // _Lua.DoString("genericMethod('thestring')");
...@@ -1357,8 +1361,8 @@ namespace LuaInterface.Tests ...@@ -1357,8 +1361,8 @@ namespace LuaInterface.Tests
if (!classWithGenericMethod.GenericMethodSuccess || (classWithGenericMethod.PassedValue as TestClass).val != 56) if (!classWithGenericMethod.GenericMethodSuccess || (classWithGenericMethod.PassedValue as TestClass).val != 56)
passed = false; passed = false;
if(passed) if (passed)
Console.WriteLine("Class with generic method passed"); Console.WriteLine("Class with generic method passed");
else else
Console.WriteLine("Class with generic method failed"); Console.WriteLine("Class with generic method failed");
...@@ -1401,7 +1405,7 @@ namespace LuaInterface.Tests ...@@ -1401,7 +1405,7 @@ namespace LuaInterface.Tests
{ {
Console.WriteLine("Starting interpreter..."); Console.WriteLine("Starting interpreter...");
Lua l = new Lua(); Lua l = new Lua();
// Pause so we can connect with the debugger // Pause so we can connect with the debugger
// Thread.Sleep(30000); // Thread.Sleep(30000);
...@@ -1517,7 +1521,7 @@ namespace LuaInterface.Tests ...@@ -1517,7 +1521,7 @@ namespace LuaInterface.Tests
Console.WriteLine("Test generics..."); Console.WriteLine("Test generics...");
obj.TestGenerics(); obj.TestGenerics();
Console.WriteLine("Test threading..."); Console.WriteLine("Test threading...");
obj.TestThreading(); obj.TestThreading();
......
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