refactor LSL_EventTests.TestStateEntryEvent into single method to test compile
parent
b58a474105
commit
d728c1beb2
|
@ -36,29 +36,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
{
|
{
|
||||||
public class LSL_EventTests : OpenSimTestCase
|
public class LSL_EventTests : OpenSimTestCase
|
||||||
{
|
{
|
||||||
|
CSCodeGenerator m_cg = new CSCodeGenerator();
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestStateEntryEvent()
|
public void TestStateEntryEvent()
|
||||||
{
|
{
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// TestHelpers.EnableLogging();
|
// TestHelpers.EnableLogging();
|
||||||
|
|
||||||
CSCodeGenerator cg = new CSCodeGenerator();
|
TestCompile("default { state_entry() {} }", false);
|
||||||
cg.Convert("default { state_entry() {} }");
|
TestCompile("default { state_entry(integer n) {} }", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TestCompile(string script, bool expectException)
|
||||||
|
{
|
||||||
|
bool gotException = false;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
bool gotException = false;
|
m_cg.Convert(script);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cg.Convert("default { state_entry(integer n) {} }");
|
|
||||||
}
|
|
||||||
catch (Exception )
|
|
||||||
{
|
|
||||||
gotException = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.That(gotException, Is.True);
|
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
gotException = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.That(gotException, Is.EqualTo(expectException));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue