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.bullet-2.82
parent
250ea09328
commit
cf95b65c10
|
@ -108,19 +108,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||||
}";
|
}";
|
||||||
|
|
||||||
CSCodeGenerator cg = new CSCodeGenerator();
|
CSCodeGenerator cg = new CSCodeGenerator();
|
||||||
string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" +
|
string output = cg.Convert(input);
|
||||||
"namespace SecondLife { " +
|
|
||||||
"public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" +
|
output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
|
||||||
"public Script() { } " +
|
System.Console.WriteLine(output);
|
||||||
cg.Convert(input) +
|
|
||||||
"} }\n";
|
|
||||||
|
|
||||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap;
|
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap;
|
||||||
|
|
||||||
m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
|
m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
|
||||||
|
|
||||||
Assert.AreEqual(new KeyValuePair<int, int>(5, 21),
|
foreach (KeyValuePair<int, int> key in positionMap.Keys)
|
||||||
positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]);
|
{
|
||||||
|
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>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue