From d728c1beb27dfd3a31f9ad084d1c4094b27b65f9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 16 Nov 2013 01:25:25 +0000 Subject: [PATCH] refactor LSL_EventTests.TestStateEntryEvent into single method to test compile --- .../Shared/CodeTools/Tests/LSL_EventTests.cs | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/LSL_EventTests.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/LSL_EventTests.cs index 2a1c19cddc..a297309116 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/LSL_EventTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/LSL_EventTests.cs @@ -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 { - bool gotException = false; - - try - { - cg.Convert("default { state_entry(integer n) {} }"); - } - catch (Exception ) - { - gotException = true; - } - - Assert.That(gotException, Is.True); + m_cg.Convert(script); } + catch (Exception) + { + gotException = true; + } + + Assert.That(gotException, Is.EqualTo(expectException)); } } } \ No newline at end of file