diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index badf82a..713b280 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.IO; | 29 | using System.IO; |
29 | using System.CodeDom.Compiler; | 30 | using System.CodeDom.Compiler; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
@@ -48,6 +49,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
48 | private CSharpCodeProvider m_CSCodeProvider; | 49 | private CSharpCodeProvider m_CSCodeProvider; |
49 | private CompilerParameters m_compilerParameters; | 50 | private CompilerParameters m_compilerParameters; |
50 | private CompilerResults m_compilerResults; | 51 | private CompilerResults m_compilerResults; |
52 | private ResolveEventHandler m_resolveEventHandler; | ||
51 | 53 | ||
52 | /// <summary> | 54 | /// <summary> |
53 | /// Creates a temporary directory where build artifacts are stored. | 55 | /// Creates a temporary directory where build artifacts are stored. |
@@ -67,7 +69,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
67 | m_CSCodeProvider = new CSharpCodeProvider(); | 69 | m_CSCodeProvider = new CSharpCodeProvider(); |
68 | m_compilerParameters = new CompilerParameters(); | 70 | m_compilerParameters = new CompilerParameters(); |
69 | 71 | ||
70 | string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory)); | 72 | string rootPath = System.AppDomain.CurrentDomain.BaseDirectory; |
73 | |||
74 | m_resolveEventHandler = new ResolveEventHandler(AssemblyResolver.OnAssemblyResolve); | ||
75 | |||
76 | System.AppDomain.CurrentDomain.AssemblyResolve += m_resolveEventHandler; | ||
77 | |||
71 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); | 78 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); |
72 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); | 79 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); |
73 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll")); | 80 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll")); |
@@ -81,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
81 | [TestFixtureTearDown] | 88 | [TestFixtureTearDown] |
82 | public void CleanUp() | 89 | public void CleanUp() |
83 | { | 90 | { |
91 | System.AppDomain.CurrentDomain.AssemblyResolve -= m_resolveEventHandler; | ||
92 | |||
84 | if (Directory.Exists(m_testDir)) | 93 | if (Directory.Exists(m_testDir)) |
85 | { | 94 | { |
86 | // Blow away the temporary directory with artifacts. | 95 | // Blow away the temporary directory with artifacts. |
@@ -166,10 +175,11 @@ default | |||
166 | 175 | ||
167 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); | 176 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); |
168 | 177 | ||
169 | // foreach (CompilerError compErr in m_compilerResults.Errors) | 178 | System.Console.WriteLine("ERRORS: {0}", m_compilerResults.Errors.Count); |
170 | // { | 179 | foreach (CompilerError compErr in m_compilerResults.Errors) |
171 | // System.Console.WriteLine("Error: {0}", compErr); | 180 | { |
172 | // } | 181 | System.Console.WriteLine("Error: {0}", compErr); |
182 | } | ||
173 | 183 | ||
174 | Assert.AreEqual(0, m_compilerResults.Errors.Count); | 184 | Assert.AreEqual(0, m_compilerResults.Errors.Count); |
175 | } | 185 | } |