You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
committed by
Jo Shields
parent
aa7da660d6
commit
c042cd0c52
@@ -1 +1 @@
|
||||
ee5dab5feff42ad4fdb081eb40b62a41efcf24e7
|
||||
7279f715f7b56052c864f30e9d57bc1123818ad0
|
@@ -633,6 +633,60 @@ namespace MonoTests.System.Collections.Generic {
|
||||
}
|
||||
}
|
||||
|
||||
#if !MOBILE
|
||||
[Test]
|
||||
public void SerializationCompatibilty ()
|
||||
{
|
||||
/* Serialization output from .net
|
||||
|
||||
var dict = new Dictionary<string, string> ();
|
||||
dict.Add ("key", "value");
|
||||
|
||||
var dictSerializedStream = new MemoryStream ();
|
||||
fmt.Serialize (dictSerializedStream, dict);
|
||||
|
||||
dictSerializedStream.Seek (0, SeekOrigin.Begin);
|
||||
var res = Convert.ToBase64String (dictSerializedStream.ToArray (), Base64FormattingOptions.InsertLineBreaks);
|
||||
|
||||
*/
|
||||
|
||||
var x = "AAEAAAD/////AQAAAAAAAAAEAQAAAOIBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuRGljdGlv" +
|
||||
"bmFyeWAyW1tTeXN0ZW0uU3RyaW5nLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJl" +
|
||||
"PW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODldLFtTeXN0ZW0uU3RyaW5n" +
|
||||
"LCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRv" +
|
||||
"a2VuPWI3N2E1YzU2MTkzNGUwODldXQQAAAAHVmVyc2lvbghDb21wYXJlcghIYXNoU2l6ZQ1LZXlW" +
|
||||
"YWx1ZVBhaXJzAAMAAwiSAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0" +
|
||||
"eUNvbXBhcmVyYDFbW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1" +
|
||||
"bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dCOYBU3lzdGVt" +
|
||||
"LkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFsdWVQYWlyYDJbW1N5c3RlbS5TdHJpbmcsIG1zY29y" +
|
||||
"bGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3" +
|
||||
"YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAs" +
|
||||
"IEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dW10BAAAA" +
|
||||
"CQIAAAADAAAACQMAAAAEAgAAAJIBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0Vx" +
|
||||
"dWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAu" +
|
||||
"MCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0AAAAA" +
|
||||
"BwMAAAAAAQAAAAEAAAAD5AFTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5LZXlWYWx1ZVBhaXJg" +
|
||||
"MltbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0" +
|
||||
"cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNj" +
|
||||
"b3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1i" +
|
||||
"NzdhNWM1NjE5MzRlMDg5XV0E/P///+QBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuS2V5VmFs" +
|
||||
"dWVQYWlyYDJbW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1" +
|
||||
"cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV0sW1N5c3RlbS5TdHJp" +
|
||||
"bmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5" +
|
||||
"VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dAgAAAANrZXkFdmFsdWUBAQYFAAAAA2tleQYGAAAABXZh" +
|
||||
"bHVlCw==";
|
||||
|
||||
var dict = new Dictionary<string, string> ();
|
||||
dict.Add ("key", "value");
|
||||
|
||||
BinaryFormatter fmt = new BinaryFormatter ();
|
||||
var mdict = (Dictionary<string, string>) fmt.Deserialize (new MemoryStream (Convert.FromBase64String (x)));
|
||||
|
||||
Assert.AreEqual (1, dict.Count);
|
||||
Assert.AreEqual (dict.Comparer.GetType (), mdict.Comparer.GetType ());
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void ZeroCapacity ()
|
||||
{
|
||||
|
@@ -37,6 +37,11 @@ namespace MonoTests.System.Collections.Generic {
|
||||
|
||||
[TestFixture]
|
||||
public class EqualityComparerTest {
|
||||
enum E
|
||||
{
|
||||
A,
|
||||
B
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Default_GetHashCode_Null ()
|
||||
@@ -59,6 +64,13 @@ namespace MonoTests.System.Collections.Generic {
|
||||
IEqualityComparer comparer = EqualityComparer<object>.Default;
|
||||
Assert.IsTrue (comparer.Equals (null, null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EnumComparison ()
|
||||
{
|
||||
Assert.IsFalse (EqualityComparer<E>.Default.Equals (E.A, E.B));
|
||||
Assert.IsFalse (EqualityComparer<object>.Default.Equals (E.A, E.B));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -625,6 +625,16 @@ namespace MonoTests.System.Globalization
|
||||
new CultureInfo ("en-HK");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChineseSimplifiedDontEqual ()
|
||||
{
|
||||
CultureInfo zh1 = new CultureInfo ("zh-Hans");
|
||||
CultureInfo zh2 = new CultureInfo ("zh-CHS");
|
||||
|
||||
Assert.IsFalse (zh1.Equals (zh2), "#1");
|
||||
Assert.IsFalse (zh2.Equals (zh1), "#2");
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
CountdownEvent barrier = new CountdownEvent (3);
|
||||
AutoResetEvent[] evt = new AutoResetEvent [] { new AutoResetEvent (false), new AutoResetEvent (false), new AutoResetEvent (false)};
|
||||
|
@@ -274,20 +274,6 @@ namespace MonoTests.System.IO
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReadUnicode ()
|
||||
{
|
||||
char testChar1 = 'H';
|
||||
using (var stream = new MemoryStream())
|
||||
using (var writer = new BinaryWriter(stream, Encoding.Unicode, true))
|
||||
using (var reader = new BinaryReader(stream, Encoding.Unicode))
|
||||
{
|
||||
writer.Write(testChar1);
|
||||
stream.Position = 0;
|
||||
Assert.AreEqual ('H', reader.ReadChar ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-TODO: (TestRead[Type]*) Verify the ReadBoolean, ReadByte ....
|
||||
// ReadBoolean, ReadByte, ReadChar, ReadInt32 Done
|
||||
@@ -1076,7 +1062,7 @@ namespace MonoTests.System.IO
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(EndOfStreamException))]
|
||||
[ExpectedException(typeof(IOException))]
|
||||
public void ReadDecimalException ()
|
||||
{
|
||||
MemoryStream stream = new MemoryStream (new byte [] {0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0 ,87, 98, 0, 0, 0, 0, 0});
|
||||
@@ -1576,5 +1562,22 @@ namespace MonoTests.System.IO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bug Xamarin #30171
|
||||
[Test]
|
||||
public void BinaryReaderRegressionMono40 ()
|
||||
{
|
||||
char testChar1 = 'H';
|
||||
using (var stream = new MemoryStream()){
|
||||
using (var writer = new BinaryWriter(stream, Encoding.Unicode, true)){
|
||||
using (var reader = new BinaryReader(stream, Encoding.Unicode)) {
|
||||
writer.Write(testChar1);
|
||||
stream.Position = 0;
|
||||
char testchar2 = reader.ReadChar();
|
||||
Assert.AreEqual (testChar1, testchar2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -87,12 +87,13 @@ namespace MonoTests.System.IO
|
||||
[Test]
|
||||
public void CtorFileNotFoundException_Mode_Open ()
|
||||
{
|
||||
const string file_name = "thisfileshouldnotexist.test";
|
||||
// absolute path
|
||||
string path = TempFolder + DSC + "thisfileshouldnotexists.test";
|
||||
string path = TempFolder + DSC + file_name;
|
||||
DeleteFile (path);
|
||||
FileStream stream = null;
|
||||
try {
|
||||
stream = new FileStream (TempFolder + DSC + "thisfileshouldnotexists.test", FileMode.Open);
|
||||
stream = new FileStream (TempFolder + DSC + file_name, FileMode.Open);
|
||||
Assert.Fail ("#A1");
|
||||
} catch (FileNotFoundException ex) {
|
||||
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#A2");
|
||||
@@ -111,14 +112,18 @@ namespace MonoTests.System.IO
|
||||
// relative path
|
||||
string orignalCurrentDir = Directory.GetCurrentDirectory ();
|
||||
Directory.SetCurrentDirectory (TempFolder);
|
||||
|
||||
// If TempFolder is a symlink, Mono will follow it and ex.FileName below will contain
|
||||
// the real directory name, not that of the TempFolder symlink and the test will fail
|
||||
// (happens e.g. on Android M)
|
||||
string realTempDir = Directory.GetCurrentDirectory ();
|
||||
path = realTempDir + DSC + file_name;
|
||||
|
||||
try {
|
||||
stream = new FileStream ("thisfileshouldnotexists.test", FileMode.Open);
|
||||
stream = new FileStream (file_name, FileMode.Open);
|
||||
Assert.Fail ("#B1");
|
||||
} catch (FileNotFoundException ex) {
|
||||
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#B2");
|
||||
// under OSX 'var' is a symlink to 'private/var'
|
||||
if (MacOSX)
|
||||
path = "/private" + path;
|
||||
Assert.AreEqual (path, ex.FileName, "#B3");
|
||||
Assert.IsNull (ex.InnerException, "#B4");
|
||||
Assert.IsNotNull (ex.Message, "#B5");
|
||||
@@ -135,8 +140,9 @@ namespace MonoTests.System.IO
|
||||
[Test]
|
||||
public void CtorFileNotFoundException_Mode_Truncate ()
|
||||
{
|
||||
const string file_name = "thisfileshouldNOTexist.test";
|
||||
// absolute path
|
||||
string path = TempFolder + DSC + "thisfileshouldNOTexists.test";
|
||||
string path = TempFolder + DSC + file_name;
|
||||
DeleteFile (path);
|
||||
FileStream stream = null;
|
||||
try {
|
||||
@@ -159,14 +165,18 @@ namespace MonoTests.System.IO
|
||||
// relative path
|
||||
string orignalCurrentDir = Directory.GetCurrentDirectory ();
|
||||
Directory.SetCurrentDirectory (TempFolder);
|
||||
|
||||
// If TempFolder is a symlink, Mono will follow it and ex.FileName below will contain
|
||||
// the real directory name, not that of the TempFolder symlink and the test will fail
|
||||
// (happens e.g. on Android M)
|
||||
string realTempDir = Directory.GetCurrentDirectory ();
|
||||
path = realTempDir + DSC + file_name;
|
||||
|
||||
try {
|
||||
stream = new FileStream ("thisfileshouldNOTexists.test", FileMode.Truncate);
|
||||
stream = new FileStream (file_name, FileMode.Truncate);
|
||||
Assert.Fail ("#B1");
|
||||
} catch (FileNotFoundException ex) {
|
||||
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#B2");
|
||||
// under OSX 'var' is a symlink to 'private/var'
|
||||
if (MacOSX)
|
||||
path = "/private" + path;
|
||||
Assert.AreEqual (path, ex.FileName, "#B3");
|
||||
Assert.IsNull (ex.InnerException, "#B4");
|
||||
Assert.IsNotNull (ex.Message, "#B5");
|
||||
@@ -183,8 +193,9 @@ namespace MonoTests.System.IO
|
||||
[Test]
|
||||
public void CtorIOException1 ()
|
||||
{
|
||||
const string file_name = "thisfileshouldexists.test";
|
||||
// absolute path
|
||||
string path = TempFolder + DSC + "thisfileshouldexists.test";
|
||||
string path = TempFolder + DSC + file_name;
|
||||
FileStream stream = null;
|
||||
DeleteFile (path);
|
||||
try {
|
||||
@@ -209,11 +220,18 @@ namespace MonoTests.System.IO
|
||||
// relative path
|
||||
string orignalCurrentDir = Directory.GetCurrentDirectory ();
|
||||
Directory.SetCurrentDirectory (TempFolder);
|
||||
|
||||
// If TempFolder is a symlink, Mono will follow it and ex.FileName below will contain
|
||||
// the real directory name, not that of the TempFolder symlink and the test will fail
|
||||
// (happens e.g. on Android M)
|
||||
string realTempDir = Directory.GetCurrentDirectory ();
|
||||
path = realTempDir + DSC + file_name;
|
||||
|
||||
try {
|
||||
stream = new FileStream ("thisfileshouldexists.test", FileMode.CreateNew);
|
||||
stream = new FileStream (file_name, FileMode.CreateNew);
|
||||
stream.Close ();
|
||||
stream = null;
|
||||
stream = new FileStream ("thisfileshouldexists.test", FileMode.CreateNew);
|
||||
stream = new FileStream (file_name, FileMode.CreateNew);
|
||||
Assert.Fail ("#B1");
|
||||
} catch (IOException ex) {
|
||||
Assert.AreEqual (typeof (IOException), ex.GetType (), "#B2");
|
||||
@@ -327,8 +345,14 @@ namespace MonoTests.System.IO
|
||||
{
|
||||
string orignalCurrentDir = Directory.GetCurrentDirectory ();
|
||||
Directory.SetCurrentDirectory (TempFolder);
|
||||
|
||||
// If TempFolder is a symlink, Mono will follow it and ex.FileName below will contain
|
||||
// the real directory name, not that of the TempFolder symlink and the test will fail
|
||||
// (happens e.g. on Android M)
|
||||
string realTempDir = Directory.GetCurrentDirectory ();
|
||||
|
||||
string relativePath = "DirectoryDoesNotExist" + Path.DirectorySeparatorChar + "file.txt";
|
||||
string fullPath = Path.Combine (TempFolder, relativePath);
|
||||
string fullPath = Path.Combine (realTempDir, relativePath);
|
||||
try {
|
||||
new FileStream (relativePath, FileMode.Open);
|
||||
Assert.Fail ("#A1");
|
||||
|
@@ -2537,6 +2537,7 @@ namespace MonoTests.System.IO
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // locks with offsets bigger than Int32.Max don't work on Android
|
||||
public void Lock_Large ()
|
||||
{
|
||||
// note: already worked without HAVE_LARGE_FILE_SUPPORT
|
||||
|
@@ -173,9 +173,10 @@ namespace MonoTests.System.IO
|
||||
Assert.AreEqual ("one", testPath, "Combine #03");
|
||||
|
||||
string current = Directory.GetCurrentDirectory ();
|
||||
bool currentIsDSC = current.Length == 1 && current [0] == DSC;
|
||||
testPath = Path.Combine (current, "one");
|
||||
|
||||
string expected = current + DSC + "one";
|
||||
string expected = (currentIsDSC ? String.Empty : current) + DSC + "one";
|
||||
Assert.AreEqual (expected, testPath, "Combine #04");
|
||||
|
||||
testPath = Path.Combine ("one", current);
|
||||
@@ -484,9 +485,9 @@ namespace MonoTests.System.IO
|
||||
public void GetFullPath ()
|
||||
{
|
||||
string current = Directory.GetCurrentDirectory ();
|
||||
|
||||
bool currentIsDSC = current.Length == 1 && current [0] == DSC;
|
||||
string testFullPath = Path.GetFullPath ("foo.txt");
|
||||
string expected = current + DSC + "foo.txt";
|
||||
string expected = (currentIsDSC ? String.Empty : current) + DSC + "foo.txt";
|
||||
Assert.AreEqual (expected, testFullPath, "GetFullPath #01");
|
||||
|
||||
testFullPath = Path.GetFullPath ("a//./.././foo.txt");
|
||||
|
@@ -1072,18 +1072,7 @@ namespace MonoTests.System.IO
|
||||
{
|
||||
UnmanagedMemoryStream ums = new UnmanagedMemoryStream(mem_byteptr,
|
||||
length, capacity, FileAccess.ReadWrite);
|
||||
try {
|
||||
ums.Position = 0x80000000;
|
||||
Assert.Fail ("#1");
|
||||
} catch (ArgumentOutOfRangeException ex) {
|
||||
// MemoryStream length must be non-negative and less than
|
||||
// 2^31 - 1 - origin
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
|
||||
Assert.IsNull (ex.InnerException, "#3");
|
||||
Assert.IsNotNull (ex.Message, "#4");
|
||||
Assert.IsNotNull (ex.ParamName, "#5");
|
||||
Assert.AreEqual ("value", ex.ParamName, "#6");
|
||||
}
|
||||
ums.Position = 0x80000000;
|
||||
ums.Close();
|
||||
}
|
||||
|
||||
|
@@ -410,6 +410,7 @@ public class AssemblyBuilderTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // DefineResource doesn't allow path in its fileName parameter and the test attempts to write to / in effect
|
||||
public void TestDefineResource ()
|
||||
{
|
||||
ab.DefineResource ("foo", "FOO", "foo.txt", ResourceAttributes.Public);
|
||||
@@ -586,6 +587,7 @@ public class AssemblyBuilderTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Missing Mono.Compilerservices.SymbolWriter assembly
|
||||
public void TestDefineDynamicModule ()
|
||||
{
|
||||
ab.DefineDynamicModule ("foo", "foo.dll");
|
||||
@@ -1829,9 +1831,13 @@ public class AssemblyBuilderTest
|
||||
fullName);
|
||||
newDomain.DoCallBack (new CrossAppDomainDelegate (helper.Test));
|
||||
} finally {
|
||||
#if !MONODROID
|
||||
// RUNTIME: crash
|
||||
// AppDomain unloading crashes the runtime on Android
|
||||
if (newDomain != null) {
|
||||
AppDomain.Unload (newDomain);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -830,6 +830,7 @@ public class ConstructorBuilderTest
|
||||
|
||||
// Same as in MethodBuilderTest
|
||||
[Test]
|
||||
[Category ("MobileNotWorking")] // No declarative security in the mobile profile
|
||||
public void AddDeclarativeSecurity_Complete ()
|
||||
{
|
||||
ConstructorBuilder cb = genClass.DefineConstructor (
|
||||
@@ -851,6 +852,7 @@ public class ConstructorBuilderTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("MobileNotWorking")] // No declarative security in the mobile profile
|
||||
public void AddDeclarativeSecurity_PSet_Null ()
|
||||
{
|
||||
ConstructorBuilder cb = genClass.DefineConstructor (
|
||||
@@ -867,6 +869,7 @@ public class ConstructorBuilderTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("MobileNotWorking")] // No declarative security in the mobile profile
|
||||
public void AddDeclarativeSecurity_Action_Invalid ()
|
||||
{
|
||||
ConstructorBuilder cb = genClass.DefineConstructor (
|
||||
@@ -892,6 +895,7 @@ public class ConstructorBuilderTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("MobileNotWorking")] // No declarative security in the mobile profile
|
||||
public void AddDeclarativeSecurity_Action_Duplicate ()
|
||||
{
|
||||
ConstructorBuilder cb = genClass.DefineConstructor (
|
||||
|
@@ -477,6 +477,8 @@ namespace MonoTests.System.Reflection.Emit
|
||||
public string Name;
|
||||
}
|
||||
|
||||
#if !MONODROID
|
||||
// RUNTIME: crash
|
||||
[Test]
|
||||
public void TypedRef ()
|
||||
{
|
||||
@@ -508,6 +510,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
{
|
||||
Assert.AreEqual (typeof (TypedRefTarget), TypedReference.GetTargetType (tr));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -136,6 +136,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
|
||||
public void DefineType_Name_Null ()
|
||||
{
|
||||
AssemblyBuilder ab = genAssembly ();
|
||||
@@ -152,6 +153,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
|
||||
public void DefineType_Name_Empty ()
|
||||
{
|
||||
AssemblyBuilder ab = genAssembly ();
|
||||
@@ -169,6 +171,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
|
||||
public void DefineType_Name_NullChar ()
|
||||
{
|
||||
AssemblyBuilder ab = genAssembly ();
|
||||
@@ -188,6 +191,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
|
||||
public void DefineType_InterfaceNotAbstract ()
|
||||
{
|
||||
AssemblyBuilder ab = genAssembly ();
|
||||
@@ -224,6 +228,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
|
||||
public void DefineType_Parent_Interface ()
|
||||
{
|
||||
TypeBuilder tb;
|
||||
@@ -241,6 +246,19 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
|
||||
public void DefineType_TypeSize ()
|
||||
{
|
||||
AssemblyBuilder ab = genAssembly ();
|
||||
ModuleBuilder mb = ab.DefineDynamicModule ("foo.dll", "foo.dll", true);
|
||||
|
||||
TypeBuilder tb = mb.DefineType ("Foo", TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.SequentialLayout,
|
||||
typeof (ValueType), 1);
|
||||
Assert.AreEqual (1, tb.Size);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void DuplicateTypeName () {
|
||||
AssemblyBuilder ab = genAssembly ();
|
||||
@@ -256,6 +274,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
|
||||
public void DuplicateSymbolDocument ()
|
||||
{
|
||||
AssemblyBuilder ab = genAssembly ();
|
||||
|
@@ -1 +1 @@
|
||||
b1b7cf320f3f5346dd7e01ef4551018929f2d874
|
||||
d3115c76913f1792f567eb5069b74d9e4fa77897
|
@@ -1112,6 +1112,7 @@ public class AssemblyNameTest {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Accessing assemblies by asm.Location is not supported
|
||||
public void GetAssemblyName_CodeBase ()
|
||||
{
|
||||
Assembly execAssembly = Assembly.GetExecutingAssembly ();
|
||||
@@ -1845,6 +1846,15 @@ public class AssemblyNameTest {
|
||||
Assert.IsTrue (AssemblyName.ReferenceMatchesDefinition (an3, an4));
|
||||
Assert.IsFalse (AssemblyName.ReferenceMatchesDefinition (an5, an6));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CultureNameInvariant ()
|
||||
{
|
||||
var an = new AssemblyName ("TestDll");
|
||||
an.CultureInfo = new CultureInfo (CultureInfo.InvariantCulture.LCID);
|
||||
|
||||
Assert.AreEqual ("", an.CultureName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ using System.Threading;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security;
|
||||
using System.Linq;
|
||||
using System.Resources;
|
||||
|
||||
namespace MonoTests.System.Reflection
|
||||
{
|
||||
@@ -122,6 +123,7 @@ namespace MonoTests.System.Reflection
|
||||
// note: only available in default appdomain
|
||||
// http://weblogs.asp.net/asanto/archive/2003/09/08/26710.aspx
|
||||
// Not sure we should emulate this behavior.
|
||||
#if !MONODROID
|
||||
string fname = AppDomain.CurrentDomain.FriendlyName;
|
||||
if (fname.EndsWith (".dll")) { // nunit-console
|
||||
Assert.IsNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
|
||||
@@ -130,10 +132,15 @@ namespace MonoTests.System.Reflection
|
||||
Assert.IsNotNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
|
||||
Assert.IsTrue (AppDomain.CurrentDomain.IsDefaultAppDomain (), "!default appdomain");
|
||||
}
|
||||
#else
|
||||
Assert.IsNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
|
||||
Assert.IsTrue (AppDomain.CurrentDomain.IsDefaultAppDomain (), "!default appdomain");
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !MONOTOUCH // Reflection.Emit is not supported.
|
||||
[Test]
|
||||
[Category("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter
|
||||
public void GetModules_MissingFile ()
|
||||
{
|
||||
AssemblyName newName = new AssemblyName ();
|
||||
@@ -183,7 +190,10 @@ namespace MonoTests.System.Reflection
|
||||
public void Corlib_test ()
|
||||
{
|
||||
Assembly corlib_test = Assembly.GetExecutingAssembly ();
|
||||
#if MOBILE
|
||||
#if MONODROID
|
||||
Assert.IsNull (corlib_test.EntryPoint, "EntryPoint");
|
||||
Assert.IsNull (corlib_test.Evidence, "Evidence");
|
||||
#elif MOBILE
|
||||
Assert.IsNotNull (corlib_test.EntryPoint, "EntryPoint");
|
||||
Assert.IsNull (corlib_test.Evidence, "Evidence");
|
||||
#else
|
||||
@@ -194,11 +204,7 @@ namespace MonoTests.System.Reflection
|
||||
|
||||
Assert.IsTrue (corlib_test.GetReferencedAssemblies ().Length > 0, "GetReferencedAssemblies");
|
||||
Assert.AreEqual (0, corlib_test.HostContext, "HostContext");
|
||||
#if NET_4_0 && !MOBILE
|
||||
Assert.AreEqual ("v4.0.30319", corlib_test.ImageRuntimeVersion, "ImageRuntimeVersion");
|
||||
#else
|
||||
Assert.AreEqual ("v2.0.50727", corlib_test.ImageRuntimeVersion, "ImageRuntimeVersion");
|
||||
#endif
|
||||
|
||||
Assert.IsNotNull (corlib_test.ManifestModule, "ManifestModule");
|
||||
Assert.IsFalse (corlib_test.ReflectionOnly, "ReflectionOnly");
|
||||
@@ -241,6 +247,7 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be accessed as FileStream
|
||||
public void GetFiles_False ()
|
||||
{
|
||||
Assembly corlib = typeof (int).Assembly;
|
||||
@@ -253,6 +260,7 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be accessed as FileStream
|
||||
public void GetFiles_True ()
|
||||
{
|
||||
Assembly corlib = typeof (int).Assembly;
|
||||
@@ -390,7 +398,7 @@ namespace MonoTests.System.Reflection
|
||||
[Test]
|
||||
public void LoadWithPartialName ()
|
||||
{
|
||||
string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "corlib_plattest", "mscorlibtests" };
|
||||
string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "corlib_plattest", "mscorlibtests", "BclTests" };
|
||||
|
||||
foreach (string s in names)
|
||||
if (Assembly.LoadWithPartialName (s) != null)
|
||||
@@ -464,6 +472,63 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SateliteAssemblyForInMemoryAssembly ()
|
||||
{
|
||||
string assemblyFileName = Path.Combine (
|
||||
Path.GetTempPath (), "AssemblyLocation1.dll");
|
||||
|
||||
try {
|
||||
AssemblyName assemblyName = new AssemblyName ();
|
||||
assemblyName.Name = "AssemblyLocation1";
|
||||
|
||||
AssemblyBuilder ab = AppDomain.CurrentDomain
|
||||
.DefineDynamicAssembly (assemblyName,
|
||||
AssemblyBuilderAccess.Save,
|
||||
Path.GetTempPath ());
|
||||
|
||||
ModuleBuilder moduleBuilder = ab.DefineDynamicModule (assemblyName.Name, assemblyName.Name + ".dll");
|
||||
TypeBuilder typeBuilder = moduleBuilder.DefineType ("Program", TypeAttributes.Public);
|
||||
|
||||
MethodBuilder methodBuilder = typeBuilder.DefineMethod ("TestCall", MethodAttributes.Public | MethodAttributes.Static, typeof(void), Type.EmptyTypes);
|
||||
ILGenerator gen = methodBuilder.GetILGenerator ();
|
||||
|
||||
//
|
||||
// var resourceManager = new ResourceManager (typeof (Program));
|
||||
// resourceManager.GetString ("test");
|
||||
//
|
||||
gen.Emit (OpCodes.Ldtoken, typeBuilder);
|
||||
gen.Emit (OpCodes.Call, typeof(Type).GetMethod ("GetTypeFromHandle"));
|
||||
gen.Emit (OpCodes.Newobj, typeof(ResourceManager).GetConstructor (new Type[] { typeof(Type) }));
|
||||
gen.Emit (OpCodes.Ldstr, "test");
|
||||
gen.Emit (OpCodes.Callvirt, typeof(ResourceManager).GetMethod ("GetString", new Type[] { typeof(string) }));
|
||||
gen.Emit (OpCodes.Pop);
|
||||
gen.Emit (OpCodes.Ret);
|
||||
|
||||
typeBuilder.CreateType ();
|
||||
|
||||
ab.Save (Path.GetFileName (assemblyFileName));
|
||||
|
||||
using (FileStream fs = File.OpenRead (assemblyFileName)) {
|
||||
byte[] buffer = new byte[fs.Length];
|
||||
fs.Read (buffer, 0, buffer.Length);
|
||||
Assembly assembly = Assembly.Load (buffer);
|
||||
|
||||
var mm = assembly.GetType ("Program").GetMethod ("TestCall");
|
||||
try {
|
||||
mm.Invoke (null, null);
|
||||
Assert.Fail ();
|
||||
} catch (TargetInvocationException e) {
|
||||
Assert.IsTrue (e.InnerException is MissingManifestResourceException);
|
||||
}
|
||||
|
||||
fs.Close ();
|
||||
}
|
||||
} finally {
|
||||
File.Delete (assemblyFileName);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void bug78464 ()
|
||||
@@ -486,6 +551,7 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MobileNotWorking")]
|
||||
public void bug78465 ()
|
||||
{
|
||||
string assemblyFileName = Path.Combine (
|
||||
@@ -523,6 +589,7 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("MobileNotWorking")]
|
||||
public void bug78468 ()
|
||||
{
|
||||
string assemblyFileNameA = Path.Combine (Path.GetTempPath (),
|
||||
@@ -605,6 +672,7 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be directly as files
|
||||
public void ReflectionOnlyLoadFrom ()
|
||||
{
|
||||
string loc = typeof (AssemblyTest).Assembly.Location;
|
||||
@@ -776,6 +844,7 @@ namespace MonoTests.System.Reflection
|
||||
|
||||
|
||||
[Test] // bug #79715
|
||||
[Category("MobileNotWorking")]
|
||||
public void Load_PartialVersion ()
|
||||
{
|
||||
string tempDir = Path.Combine (Path.GetTempPath (),
|
||||
|
@@ -318,7 +318,6 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void SelectMethod_AmbiguousMatch ()
|
||||
{
|
||||
Type type = typeof (BinderTest);
|
||||
@@ -402,7 +401,6 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void SelectMethod_Params ()
|
||||
{
|
||||
Type type = typeof (BinderTest);
|
||||
@@ -542,8 +540,11 @@ namespace MonoTests.System.Reflection
|
||||
BindingFlags.Public |
|
||||
BindingFlags.Instance);
|
||||
|
||||
PropertyInfo prop = binder.SelectProperty (0, props, null, new Type [] {null}, null);
|
||||
Assert.IsNotNull (prop);
|
||||
try {
|
||||
binder.SelectProperty (0, props, null, new Type [] {null}, null);
|
||||
Assert.Fail ();
|
||||
} catch (ArgumentNullException) {
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -586,7 +587,6 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void BindToMethod_AmbiguousMatch ()
|
||||
{
|
||||
Type type = typeof (BinderTest);
|
||||
@@ -651,7 +651,6 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void BindToMethod_Params ()
|
||||
{
|
||||
Type type = typeof (BinderTest);
|
||||
@@ -811,8 +810,6 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
[Category ("NotWorking")]
|
||||
public void BindToMethod_Params_Mono ()
|
||||
{
|
||||
Type type = typeof (BinderTest);
|
||||
@@ -872,7 +869,6 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void BindToMethod_Params_MS ()
|
||||
{
|
||||
Type type = typeof (BinderTest);
|
||||
@@ -908,26 +904,11 @@ namespace MonoTests.System.Reflection
|
||||
null, out state);
|
||||
Assert.AreSame (mi_params, selected, "#D1");
|
||||
args = new object [] { new object (), new object () };
|
||||
try {
|
||||
binder.BindToMethod (flags, match, ref args, null, culture,
|
||||
null, out state);
|
||||
Assert.Fail ("#D2");
|
||||
} catch (AmbiguousMatchException) {
|
||||
}
|
||||
binder.BindToMethod (flags, match, ref args, null, culture, null, out state);
|
||||
args = new object [] { new object (), new object [0] };
|
||||
try {
|
||||
binder.BindToMethod (flags, match, ref args, null, culture,
|
||||
null, out state);
|
||||
Assert.Fail ("#D3");
|
||||
} catch (AmbiguousMatchException) {
|
||||
}
|
||||
binder.BindToMethod (flags, match, ref args, null, culture, null, out state);
|
||||
args = new object [] { new object (), new object (), new object () };
|
||||
try {
|
||||
binder.BindToMethod (flags, match, ref args, null, culture,
|
||||
null, out state);
|
||||
Assert.Fail ("#D4");
|
||||
} catch (IndexOutOfRangeException) {
|
||||
}
|
||||
binder.BindToMethod (flags, match, ref args, null, culture, null, out state);
|
||||
|
||||
match = new MethodBase [] { mi_params, mi_non_params, mi_single_param };
|
||||
args = new object [] { new object () };
|
||||
@@ -937,7 +918,7 @@ namespace MonoTests.System.Reflection
|
||||
args = new object [] { new object (), new object () };
|
||||
selected = binder.BindToMethod (flags, match, ref args, null, culture,
|
||||
null, out state);
|
||||
Assert.AreSame (mi_params, selected, "#E2");
|
||||
Assert.AreNotSame (mi_params, selected, "#E2");
|
||||
}
|
||||
|
||||
[Test] // bug #41691
|
||||
@@ -1461,7 +1442,6 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
|
||||
[Test] // bug #636939
|
||||
[Category ("NotWorking")]
|
||||
public void SelectMethodWithParamArrayAndNonEqualTypeArguments ()
|
||||
{
|
||||
const BindingFlags flags =
|
||||
|
@@ -140,5 +140,14 @@ namespace MonoTests.System.Reflection
|
||||
var ctor = typeof (Gen<>).GetConstructor (Type.EmptyTypes);
|
||||
Assert.IsTrue (ctor.ContainsGenericParameters);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConstructorInfoModule ()
|
||||
{
|
||||
Type type = typeof (Foo);
|
||||
ConstructorInfo co = type.GetConstructors ()[0];
|
||||
|
||||
Assert.AreEqual (type.Module, co.Module);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -114,6 +114,15 @@ namespace MonoTests.System.Reflection
|
||||
} catch (InvalidOperationException) {}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EventInfoModule ()
|
||||
{
|
||||
Type type = typeof (TestClass);
|
||||
EventInfo ev = type.GetEvent ("pub");
|
||||
|
||||
Assert.AreEqual (type.Module, ev.Module);
|
||||
}
|
||||
|
||||
#pragma warning disable 67
|
||||
public class PrivateEvent
|
||||
{
|
||||
|
@@ -58,13 +58,13 @@ namespace MonoTests.System.Reflection
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=100)]
|
||||
public string f2;
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof (Marshal1), MarshalCookie="5")]
|
||||
public int f3;
|
||||
|
||||
[MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof (Marshal1), MarshalCookie = "5")]
|
||||
public object f4;
|
||||
|
||||
#endif
|
||||
[Obsolete]
|
||||
public int f5;
|
||||
}
|
||||
@@ -170,6 +170,15 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FieldInfoModule ()
|
||||
{
|
||||
Type type = typeof (FieldInfoTest);
|
||||
FieldInfo field = type.GetField ("i");
|
||||
|
||||
Assert.AreEqual (type.Module, field.Module);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCustomAttributes ()
|
||||
{
|
||||
@@ -347,10 +356,12 @@ namespace MonoTests.System.Reflection
|
||||
Assert.AreEqual (UnmanagedType.ByValTStr, attr.Value, "#E2");
|
||||
Assert.AreEqual (100, attr.SizeConst, "#E3");
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
attrs = typeof (Class2).GetField ("f3").GetCustomAttributes (true);
|
||||
Assert.AreEqual (1, attrs.Length, "#F1");
|
||||
attr = (MarshalAsAttribute) attrs [0];
|
||||
Assert.AreEqual (UnmanagedType.CustomMarshaler, attr.Value, "#F2");
|
||||
|
||||
Assert.AreEqual ("5", attr.MarshalCookie, "#F3");
|
||||
Assert.AreEqual (typeof (Marshal1), Type.GetType (attr.MarshalType), "#F4");
|
||||
|
||||
@@ -375,6 +386,7 @@ namespace MonoTests.System.Reflection
|
||||
Assert.AreEqual (UnmanagedType.CustomMarshaler, attr.Value, "#I2");
|
||||
Assert.AreEqual ("5", attr.MarshalCookie, "#I3");
|
||||
Assert.AreEqual (typeof (Marshal1), Type.GetType (attr.MarshalType), "#I4");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Disable "field not used warning", this is intended.
|
||||
@@ -1329,6 +1341,27 @@ namespace MonoTests.System.Reflection
|
||||
Throws (field, instance, new int[] { 3 });
|
||||
}
|
||||
|
||||
struct TestFields {
|
||||
public int MaxValue;
|
||||
public string str;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetValueDirect ()
|
||||
{
|
||||
TestFields fields = new TestFields { MaxValue = 1234, str = "A" };
|
||||
|
||||
FieldInfo info = fields.GetType ().GetField ("MaxValue");
|
||||
TypedReference reference = __makeref(fields);
|
||||
info.SetValueDirect (reference, 4096);
|
||||
Assert.AreEqual (4096, fields.MaxValue);
|
||||
|
||||
info = fields.GetType ().GetField ("str");
|
||||
reference = __makeref(fields);
|
||||
info.SetValueDirect (reference, "B");
|
||||
Assert.AreEqual ("B", fields.str);
|
||||
}
|
||||
|
||||
public IntEnum PPP;
|
||||
|
||||
public class Foo<T>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user