diff options
author | Justin Clark-Casey (justincc) | 2014-05-23 22:12:49 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-05-23 22:12:49 +0100 |
commit | 250ea09328253422ff2a0e4877ee9968556328f0 (patch) | |
tree | b56479888b09c13c46854b8279c386e7d45e40c2 /OpenSim/Region/ScriptEngine | |
parent | Add mikemig to contributors (diff) | |
download | opensim-SC_OLD-250ea09328253422ff2a0e4877ee9968556328f0.zip opensim-SC_OLD-250ea09328253422ff2a0e4877ee9968556328f0.tar.gz opensim-SC_OLD-250ea09328253422ff2a0e4877ee9968556328f0.tar.bz2 opensim-SC_OLD-250ea09328253422ff2a0e4877ee9968556328f0.tar.xz |
Reactivate regression test TestCastAndConcatString() in CompilerTests.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | 24 |
2 files changed, 18 insertions, 10 deletions
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 | |||
444 | // return compileScript; | 444 | // return compileScript; |
445 | // } | 445 | // } |
446 | 446 | ||
447 | private static string CreateCSCompilerScript( | 447 | public static string CreateCSCompilerScript( |
448 | string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters) | 448 | string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters) |
449 | { | 449 | { |
450 | compileScript = string.Format( | 450 | compileScript = string.Format( |
@@ -472,7 +472,7 @@ namespace SecondLife | |||
472 | return compileScript; | 472 | return compileScript; |
473 | } | 473 | } |
474 | 474 | ||
475 | private static string CreateVBCompilerScript(string compileScript, string className, string baseClassName) | 475 | public static string CreateVBCompilerScript(string compileScript, string className, string baseClassName) |
476 | { | 476 | { |
477 | compileScript = String.Empty + | 477 | compileScript = String.Empty + |
478 | "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + | 478 | "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; | |||
31 | using Microsoft.CSharp; | 31 | using Microsoft.CSharp; |
32 | using NUnit.Framework; | 32 | using NUnit.Framework; |
33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
34 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | ||
34 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
35 | 36 | ||
36 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | 37 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests |
@@ -66,9 +67,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
66 | m_CSCodeProvider = new CSharpCodeProvider(); | 67 | m_CSCodeProvider = new CSharpCodeProvider(); |
67 | m_compilerParameters = new CompilerParameters(); | 68 | m_compilerParameters = new CompilerParameters(); |
68 | 69 | ||
69 | string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory), "bin"); | 70 | string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory)); |
70 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); | 71 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); |
71 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); | 72 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); |
73 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll")); | ||
72 | m_compilerParameters.GenerateExecutable = false; | 74 | m_compilerParameters.GenerateExecutable = false; |
73 | } | 75 | } |
74 | 76 | ||
@@ -112,6 +114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
112 | "public Script() { } " + | 114 | "public Script() { } " + |
113 | cg.Convert(input) + | 115 | cg.Convert(input) + |
114 | "} }\n"; | 116 | "} }\n"; |
117 | |||
115 | Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap; | 118 | Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap; |
116 | 119 | ||
117 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); | 120 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); |
@@ -124,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
124 | /// Test that a string can be cast to string and another string | 127 | /// Test that a string can be cast to string and another string |
125 | /// concatenated. | 128 | /// concatenated. |
126 | /// </summary> | 129 | /// </summary> |
127 | //[Test] | 130 | [Test] |
128 | public void TestCastAndConcatString() | 131 | public void TestCastAndConcatString() |
129 | { | 132 | { |
130 | TestHelpers.InMethod(); | 133 | TestHelpers.InMethod(); |
@@ -143,15 +146,20 @@ default | |||
143 | } | 146 | } |
144 | }"; | 147 | }"; |
145 | 148 | ||
149 | // System.Console.WriteLine(input); | ||
146 | CSCodeGenerator cg = new CSCodeGenerator(); | 150 | CSCodeGenerator cg = new CSCodeGenerator(); |
147 | string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" + | 151 | string output = cg.Convert(input); |
148 | "namespace SecondLife { " + | 152 | |
149 | "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" + | 153 | output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null); |
150 | "public Script() { } " + | 154 | // System.Console.WriteLine(output); |
151 | cg.Convert(input) + | 155 | |
152 | "} }\n"; | ||
153 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); | 156 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); |
154 | 157 | ||
158 | // foreach (CompilerError compErr in m_compilerResults.Errors) | ||
159 | // { | ||
160 | // System.Console.WriteLine("Error: {0}", compErr); | ||
161 | // } | ||
162 | |||
155 | Assert.AreEqual(0, m_compilerResults.Errors.Count); | 163 | Assert.AreEqual(0, m_compilerResults.Errors.Count); |
156 | } | 164 | } |
157 | } | 165 | } |