You've already forked linux-packaging-mono
Imported Upstream version 4.4.2.4
Former-commit-id: 92904c9c5915c37244316e42ba99e7b934ed7ee2
This commit is contained in:
parent
589d484eee
commit
0b4a830db1
@ -16,6 +16,8 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.CSharp;
|
||||
using NUnit.Framework;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
|
||||
namespace MonoTests.Microsoft.CSharp
|
||||
{
|
||||
@ -566,6 +568,39 @@ namespace MonoTests.Microsoft.CSharp
|
||||
AssertCompileResults (results, true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncodingMismatch ()
|
||||
{
|
||||
var source = @"
|
||||
#warning Trigger Some Warning
|
||||
public class MyClass {
|
||||
public static string MyMethod () { return ""data""; }
|
||||
}";
|
||||
|
||||
var p = new CompilerParameters () {
|
||||
GenerateInMemory = false,
|
||||
GenerateExecutable = false,
|
||||
IncludeDebugInformation = true,
|
||||
TreatWarningsAsErrors = false,
|
||||
TempFiles = new TempFileCollection (_tempDir, true),
|
||||
};
|
||||
|
||||
var prov = new CSharpCodeProvider ();
|
||||
CompilerResults results;
|
||||
|
||||
var prev = Console.OutputEncoding;
|
||||
try {
|
||||
Console.OutputEncoding = Encoding.Unicode;
|
||||
|
||||
results = prov.CompileAssemblyFromSource (p, source);
|
||||
} finally {
|
||||
Console.OutputEncoding = prev;
|
||||
}
|
||||
|
||||
Assert.IsNotNull (results.Errors);
|
||||
Assert.IsTrue (results.Output.Cast<string>().ToArray ()[1].Contains ("Trigger Some Warning"));
|
||||
}
|
||||
|
||||
private static string CreateTempDirectory ()
|
||||
{
|
||||
// create a uniquely named zero-byte file
|
||||
|
Reference in New Issue
Block a user