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 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; bool gotException = false;
try try
{ {
cg.Convert("default { state_entry(integer n) {} }"); m_cg.Convert(script);
} }
catch (Exception) catch (Exception)
{ {
gotException = true; gotException = true;
} }
Assert.That(gotException, Is.True); Assert.That(gotException, Is.EqualTo(expectException));
}
} }
} }
} }