refactor LSL_EventTests.TestStateEntryEvent into single method to test compile

link-sitting
Justin Clark-Casey (justincc) 2013-11-16 01:25:25 +00:00
parent b58a474105
commit d728c1beb2
1 changed files with 17 additions and 14 deletions

View File

@ -36,29 +36,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
{
public class LSL_EventTests : OpenSimTestCase
{
CSCodeGenerator m_cg = new CSCodeGenerator();
[Test]
public void TestStateEntryEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
CSCodeGenerator cg = new CSCodeGenerator();
cg.Convert("default { state_entry() {} }");
TestCompile("default { state_entry() {} }", false);
TestCompile("default { state_entry(integer n) {} }", true);
}
private void TestCompile(string script, bool expectException)
{
bool gotException = false;
try
{
cg.Convert("default { state_entry(integer n) {} }");
m_cg.Convert(script);
}
catch (Exception)
{
gotException = true;
}
Assert.That(gotException, Is.True);
}
Assert.That(gotException, Is.EqualTo(expectException));
}
}
}