aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-05-23 22:29:47 +0100
committerJustin Clark-Casey (justincc)2014-05-23 22:29:47 +0100
commitcf95b65c10c285b297257db492fbeb9dc19d1d4c (patch)
tree7d1724a7656f732adf1b5974497a3495e813334a /OpenSim/Region/ScriptEngine
parentReactivate regression test TestCastAndConcatString() in CompilerTests. (diff)
downloadopensim-SC_OLD-cf95b65c10c285b297257db492fbeb9dc19d1d4c.zip
opensim-SC_OLD-cf95b65c10c285b297257db492fbeb9dc19d1d4c.tar.gz
opensim-SC_OLD-cf95b65c10c285b297257db492fbeb9dc19d1d4c.tar.bz2
opensim-SC_OLD-cf95b65c10c285b297257db492fbeb9dc19d1d4c.tar.xz
Get regression test TestUseUndeclaredVariable() functional again, though not yet enabled.
This reveals the position map problems and will make the fix (and subsequent continual checking) easier.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs27
1 files changed, 19 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
index 29b6006..ab68793 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
@@ -108,19 +108,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
108}"; 108}";
109 109
110 CSCodeGenerator cg = new CSCodeGenerator(); 110 CSCodeGenerator cg = new CSCodeGenerator();
111 string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" + 111 string output = cg.Convert(input);
112 "namespace SecondLife { " + 112
113 "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" + 113 output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
114 "public Script() { } " + 114 System.Console.WriteLine(output);
115 cg.Convert(input) +
116 "} }\n";
117 115
118 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap; 116 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap;
119 117
120 m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); 118 m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
121 119
122 Assert.AreEqual(new KeyValuePair<int, int>(5, 21), 120 foreach (KeyValuePair<int, int> key in positionMap.Keys)
123 positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]); 121 {
122 KeyValuePair<int, int> val = positionMap[key];
123
124 System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value);
125 }
126
127 foreach (CompilerError compErr in m_compilerResults.Errors)
128 {
129 System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr);
130 }
131
132 Assert.AreEqual(
133 new KeyValuePair<int, int>(5, 21),
134 positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]);
124 } 135 }
125 136
126 /// <summary> 137 /// <summary>