From 250ea09328253422ff2a0e4877ee9968556328f0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 May 2014 22:12:49 +0100 Subject: Reactivate regression test TestCastAndConcatString() in CompilerTests. --- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 4 ++-- .../Shared/CodeTools/Tests/CompilerTest.cs | 24 ++++++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index b4640ef..1efe798 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -444,7 +444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools // return compileScript; // } - private static string CreateCSCompilerScript( + public static string CreateCSCompilerScript( string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters) { compileScript = string.Format( @@ -472,7 +472,7 @@ namespace SecondLife return compileScript; } - private static string CreateVBCompilerScript(string compileScript, string className, string baseClassName) + public static string CreateVBCompilerScript(string compileScript, string className, string baseClassName) { compileScript = String.Empty + "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index 05a8756..29b6006 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using Microsoft.CSharp; using NUnit.Framework; using OpenSim.Region.ScriptEngine.Shared.CodeTools; +using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Tests.Common; namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests @@ -66,9 +67,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests m_CSCodeProvider = new CSharpCodeProvider(); m_compilerParameters = new CompilerParameters(); - string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory), "bin"); + string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory)); m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); + m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll")); m_compilerParameters.GenerateExecutable = false; } @@ -112,6 +114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests "public Script() { } " + cg.Convert(input) + "} }\n"; + Dictionary, KeyValuePair> positionMap = cg.PositionMap; m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); @@ -124,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests /// Test that a string can be cast to string and another string /// concatenated. /// - //[Test] + [Test] public void TestCastAndConcatString() { TestHelpers.InMethod(); @@ -143,15 +146,20 @@ default } }"; +// System.Console.WriteLine(input); CSCodeGenerator cg = new CSCodeGenerator(); - string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" + - "namespace SecondLife { " + - "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" + - "public Script() { } " + - cg.Convert(input) + - "} }\n"; + string output = cg.Convert(input); + + output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null); +// System.Console.WriteLine(output); + m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); +// foreach (CompilerError compErr in m_compilerResults.Errors) +// { +// System.Console.WriteLine("Error: {0}", compErr); +// } + Assert.AreEqual(0, m_compilerResults.Errors.Count); } } -- cgit v1.1