aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-05-23 22:12:49 +0100
committerJustin Clark-Casey (justincc)2014-05-23 22:12:49 +0100
commit250ea09328253422ff2a0e4877ee9968556328f0 (patch)
treeb56479888b09c13c46854b8279c386e7d45e40c2 /OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests
parentAdd mikemig to contributors (diff)
downloadopensim-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 '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs24
1 files changed, 16 insertions, 8 deletions
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;
31using Microsoft.CSharp; 31using Microsoft.CSharp;
32using NUnit.Framework; 32using NUnit.Framework;
33using OpenSim.Region.ScriptEngine.Shared.CodeTools; 33using OpenSim.Region.ScriptEngine.Shared.CodeTools;
34using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
34using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
35 36
36namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests 37namespace 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 }