From d41c1f40a8abfb466741d2ccec55e21f11e6b63f Mon Sep 17 00:00:00 2001 From: Johan Berntsson Date: Thu, 10 Jul 2008 05:40:45 +0000 Subject: Patch from Mike: errors from the LSL/C# compilers are now reported to the user in-world --- .../Shared/CodeTools/LSLCompilerTest.cs | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs index 6e42c16..56a5b4c 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs @@ -26,6 +26,7 @@ */ using System.Collections.Generic; +using System.Text.RegularExpressions; using NUnit.Framework; using OpenSim.Region.ScriptEngine.Shared.CodeTools; @@ -1299,5 +1300,35 @@ default string output = cg.Generate(); Assert.AreEqual(expected, output); } + + [Test] + [ExpectedException("Tools.CSToolsException")] + public void TestSyntaxError() + { + string input = @"default +{ + state_entry() + { + integer y + } +} +"; + try + { + CSCodeGenerator cg = new CSCodeGenerator(input); + string output = cg.Generate(); + } + catch (Tools.CSToolsException e) + { + // The syntax error is on line 6, char 5 (expected ';', found + // '}'). + Regex r = new Regex("Line ([0-9]+), char ([0-9]+)"); + Match m = r.Match(e.Message); + Assert.AreEqual("6", m.Groups[1].Value); + Assert.AreEqual("5", m.Groups[2].Value); + + throw; + } + } } } -- cgit v1.1