diff options
author | onefang | 2019-09-11 16:36:50 +1000 |
---|---|---|
committer | onefang | 2019-09-11 16:36:50 +1000 |
commit | 50cd1ffd32f69228e566f2b0b89f86ea0d9fe489 (patch) | |
tree | 52f2ab0c04f1a5d7d6ac5dc872981b4b156447e7 /OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | |
parent | Renamed branch to SledjChisl. (diff) | |
parent | Bump to release flavour, build 0. (diff) | |
download | opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.zip opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.gz opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.bz2 opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.xz |
Merge branch 'SledjChisl'
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index b476e32..12ba4de 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Tests.Common; | |||
37 | 37 | ||
38 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | 38 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests |
39 | { | 39 | { |
40 | |||
40 | /// <summary> | 41 | /// <summary> |
41 | /// Tests the LSL compiler. Among other things, test that error messages | 42 | /// Tests the LSL compiler. Among other things, test that error messages |
42 | /// generated by the C# compiler can be mapped to prper lines/columns in | 43 | /// generated by the C# compiler can be mapped to prper lines/columns in |
@@ -80,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
80 | m_resolveEventHandler = new ResolveEventHandler(AssemblyResolver.OnAssemblyResolve); | 81 | m_resolveEventHandler = new ResolveEventHandler(AssemblyResolver.OnAssemblyResolve); |
81 | 82 | ||
82 | System.AppDomain.CurrentDomain.AssemblyResolve += m_resolveEventHandler; | 83 | System.AppDomain.CurrentDomain.AssemblyResolve += m_resolveEventHandler; |
83 | 84 | ||
84 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); | 85 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); |
85 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); | 86 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); |
86 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll")); | 87 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll")); |
@@ -111,7 +112,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
111 | CSCodeGenerator cg = new CSCodeGenerator(); | 112 | CSCodeGenerator cg = new CSCodeGenerator(); |
112 | string output = cg.Convert(input); | 113 | string output = cg.Convert(input); |
113 | 114 | ||
114 | output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null); | 115 | output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null); |
115 | // System.Console.WriteLine(output); | 116 | // System.Console.WriteLine(output); |
116 | 117 | ||
117 | positionMap = cg.PositionMap; | 118 | positionMap = cg.PositionMap; |
@@ -132,7 +133,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
132 | 133 | ||
133 | return compilerResults; | 134 | return compilerResults; |
134 | } | 135 | } |
135 | 136 | /* test too depedent on counting lines and columns maping code generation changes | |
137 | erros position is better tested on viewers | ||
136 | /// <summary> | 138 | /// <summary> |
137 | /// Test that line number errors are resolved as expected when preceding code contains a jump. | 139 | /// Test that line number errors are resolved as expected when preceding code contains a jump. |
138 | /// </summary> | 140 | /// </summary> |
@@ -152,13 +154,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
152 | @l; | 154 | @l; |
153 | i = 1; | 155 | i = 1; |
154 | } | 156 | } |
155 | }", out positionMap); | 157 | }", out positionMap); |
156 | 158 | ||
157 | Assert.AreEqual( | 159 | Assert.AreEqual( |
158 | new KeyValuePair<int, int>(7, 9), | 160 | new KeyValuePair<int, int>(7, 9), |
159 | positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]); | 161 | positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]); |
160 | } | 162 | } |
161 | 163 | ||
164 | |||
162 | /// <summary> | 165 | /// <summary> |
163 | /// Test the C# compiler error message can be mapped to the correct | 166 | /// Test the C# compiler error message can be mapped to the correct |
164 | /// line/column in the LSL source when an undeclared variable is used. | 167 | /// line/column in the LSL source when an undeclared variable is used. |
@@ -183,7 +186,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
183 | new KeyValuePair<int, int>(5, 21), | 186 | new KeyValuePair<int, int>(5, 21), |
184 | positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]); | 187 | positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]); |
185 | } | 188 | } |
186 | 189 | */ | |
187 | /// <summary> | 190 | /// <summary> |
188 | /// Test that a string can be cast to string and another string | 191 | /// Test that a string can be cast to string and another string |
189 | /// concatenated. | 192 | /// concatenated. |