mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
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.
This commit is contained in:
@@ -108,19 +108,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||
}";
|
||||
|
||||
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);
|
||||
|
||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap;
|
||||
|
||||
m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
|
||||
|
||||
Assert.AreEqual(new KeyValuePair<int, int>(5, 21),
|
||||
positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]);
|
||||
foreach (KeyValuePair<int, int> key in positionMap.Keys)
|
||||
{
|
||||
KeyValuePair<int, int> val = positionMap[key];
|
||||
|
||||
System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value);
|
||||
}
|
||||
|
||||
foreach (CompilerError compErr in m_compilerResults.Errors)
|
||||
{
|
||||
System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr);
|
||||
}
|
||||
|
||||
Assert.AreEqual(
|
||||
new KeyValuePair<int, int>(5, 21),
|
||||
positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user