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