Reactivate regression test TestCastAndConcatString() in CompilerTests.

bullet-2.82
Justin Clark-Casey (justincc) 2014-05-23 22:12:49 +01:00
parent b3a496d6f2
commit 250ea09328
2 changed files with 18 additions and 10 deletions

View File

@ -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: " +

View File

@ -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<int, int>, KeyValuePair<int, int>> 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.
/// </summary>
//[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);
}
}