You've already forked linux-packaging-mono
Imported Upstream version 6.0.0.172
Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
parent
8016999e4d
commit
64ac736ec5
@ -18,12 +18,14 @@ using Microsoft.CSharp;
|
||||
using NUnit.Framework;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.Microsoft.CSharp
|
||||
{
|
||||
[TestFixture]
|
||||
public class CSharpCodeProviderTest
|
||||
{
|
||||
private TempDirectory _tempDirectory;
|
||||
private string _tempDir;
|
||||
private CodeDomProvider _codeProvider;
|
||||
|
||||
@ -38,13 +40,14 @@ namespace MonoTests.Microsoft.CSharp
|
||||
public void SetUp ()
|
||||
{
|
||||
_codeProvider = new CSharpCodeProvider ();
|
||||
_tempDir = CreateTempDirectory ();
|
||||
_tempDirectory = new TempDirectory ();
|
||||
_tempDir = _tempDirectory.Path;
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
RemoveDirectory (_tempDir);
|
||||
_tempDirectory.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -430,8 +433,6 @@ namespace MonoTests.Microsoft.CSharp
|
||||
// verify we don't cleanup files in temp directory too agressively
|
||||
string[] tempFiles = Directory.GetFiles (_tempDir);
|
||||
Assert.AreEqual (2, tempFiles.Length, "#C1");
|
||||
Assert.AreEqual (tempFile, tempFiles[0], "#C2");
|
||||
Assert.AreEqual (outputAssembly, tempFiles [1], "#C3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -601,37 +602,6 @@ namespace MonoTests.Microsoft.CSharp
|
||||
Assert.IsTrue (results.Output.Cast<string>().ToArray ()[1].Contains ("Trigger Some Warning"));
|
||||
}
|
||||
|
||||
private static string CreateTempDirectory ()
|
||||
{
|
||||
// create a uniquely named zero-byte file
|
||||
string tempFile = Path.GetTempFileName ();
|
||||
// remove the temporary file
|
||||
File.Delete (tempFile);
|
||||
// create a directory named after the unique temporary file
|
||||
Directory.CreateDirectory (tempFile);
|
||||
// return the path to the temporary directory
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
private static void RemoveDirectory (string path)
|
||||
{
|
||||
try {
|
||||
if (Directory.Exists (path)) {
|
||||
string[] directoryNames = Directory.GetDirectories (path);
|
||||
foreach (string directoryName in directoryNames) {
|
||||
RemoveDirectory (directoryName);
|
||||
}
|
||||
string[] fileNames = Directory.GetFiles (path);
|
||||
foreach (string fileName in fileNames) {
|
||||
File.Delete (fileName);
|
||||
}
|
||||
Directory.Delete (path, true);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new AssertionException ("Unable to cleanup '" + path + "'.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AssertCompileResults (CompilerResults results, bool allowWarnings)
|
||||
{
|
||||
foreach (CompilerError compilerError in results.Errors) {
|
||||
|
Reference in New Issue
Block a user