diff options
author | Mike Mazur | 2008-08-20 06:09:11 +0000 |
---|---|---|
committer | Mike Mazur | 2008-08-20 06:09:11 +0000 |
commit | 2b83169c4b0972752c22c1e69462a01225f1745e (patch) | |
tree | 4d57fa660c7ac036a15abb68aa97304a313fdc3a | |
parent | Mantis #2003 - thank you, SachaMagne, for a patch that implements (diff) | |
download | opensim-SC_OLD-2b83169c4b0972752c22c1e69462a01225f1745e.zip opensim-SC_OLD-2b83169c4b0972752c22c1e69462a01225f1745e.tar.gz opensim-SC_OLD-2b83169c4b0972752c22c1e69462a01225f1745e.tar.bz2 opensim-SC_OLD-2b83169c4b0972752c22c1e69462a01225f1745e.tar.xz |
Adding unit test for issue 2006, though it's commented out as those compiler
tests tend to tank on our continuous build server.
-rw-r--r-- | OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CompilerTest.cs | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CompilerTest.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CompilerTest.cs index 43e3143..7725d8d 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CompilerTest.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CompilerTest.cs | |||
@@ -85,11 +85,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | //[Test] | ||
89 | /// <summary> | 88 | /// <summary> |
90 | /// Test the C# compiler error message can be mapped to the correct | 89 | /// Test the C# compiler error message can be mapped to the correct |
91 | /// line/column in the LSL source when an undeclared variable is used. | 90 | /// line/column in the LSL source when an undeclared variable is used. |
92 | /// </summary> | 91 | /// </summary> |
92 | //[Test] | ||
93 | public void TestUseUndeclaredVariable() | 93 | public void TestUseUndeclaredVariable() |
94 | { | 94 | { |
95 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); | 95 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); |
@@ -116,5 +116,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
116 | Assert.AreEqual(new KeyValuePair<int, int>(5, 21), | 116 | Assert.AreEqual(new KeyValuePair<int, int>(5, 21), |
117 | positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]); | 117 | positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]); |
118 | } | 118 | } |
119 | |||
120 | /// <summary> | ||
121 | /// Test that a string can be cast to string and another string | ||
122 | /// concatenated. | ||
123 | /// </summary> | ||
124 | //[Test] | ||
125 | public void TestCastAndConcatString() | ||
126 | { | ||
127 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); | ||
128 | |||
129 | string input = @"string s = "" a string""; | ||
130 | |||
131 | default | ||
132 | { | ||
133 | state_entry() | ||
134 | { | ||
135 | key gAvatarKey = llDetectedKey(0); | ||
136 | string tmp = (string) gAvatarKey + s; | ||
137 | llSay(0, tmp); | ||
138 | } | ||
139 | }"; | ||
140 | |||
141 | CSCodeGenerator cg = new CSCodeGenerator(); | ||
142 | string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" + | ||
143 | "namespace SecondLife { " + | ||
144 | "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" + | ||
145 | "public Script() { } " + | ||
146 | cg.Convert(input) + | ||
147 | "} }\n"; | ||
148 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); | ||
149 | |||
150 | Assert.AreEqual(0, m_compilerResults.Errors.Count); | ||
151 | } | ||
119 | } | 152 | } |
120 | } | 153 | } |