You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
@@ -4,10 +4,6 @@ using System.Text;
|
||||
using NUnit.Framework;
|
||||
using Mono;
|
||||
|
||||
#if !MOBILE
|
||||
using NUnit.Framework.SyntaxHelpers;
|
||||
#endif
|
||||
|
||||
namespace MonoTests.Mono {
|
||||
|
||||
[TestFixture]
|
||||
|
||||
@@ -32,9 +32,6 @@ using System.Collections.Concurrent;
|
||||
|
||||
using NUnit;
|
||||
using NUnit.Framework;
|
||||
#if !MOBILE
|
||||
using NUnit.Framework.SyntaxHelpers;
|
||||
#endif
|
||||
|
||||
namespace MonoTests.System.Collections.Concurrent
|
||||
{
|
||||
|
||||
@@ -30,9 +30,6 @@ using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
using NUnit.Framework;
|
||||
#if !MOBILE
|
||||
using NUnit.Framework.SyntaxHelpers;
|
||||
#endif
|
||||
|
||||
namespace MonoTests.System.Collections.Concurrent
|
||||
{
|
||||
|
||||
@@ -608,10 +608,7 @@ namespace MonoTests.System.Globalization
|
||||
[ExpectedException (typeof (CultureNotFoundException))]
|
||||
public void CultureNotFound ()
|
||||
{
|
||||
// that's how the 'locale' gets defined for a device with an English UI
|
||||
// and it's international settings set for Hong Kong
|
||||
// https://bugzilla.xamarin.com/show_bug.cgi?id=3471
|
||||
new CultureInfo ("en-HK");
|
||||
new CultureInfo ("en-HKX");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -149,13 +149,17 @@ public class TextInfoTest {
|
||||
case 0x63: // ps
|
||||
case 90: // syr
|
||||
case 101: // div
|
||||
case 128: // ur
|
||||
case 1025: // ar-SA
|
||||
case 1037: // he-IL
|
||||
case 1056: // ur-PK
|
||||
case 1065: // ra-IR
|
||||
case 1114: // syr-SY
|
||||
case 1125: // div-MV
|
||||
case 1152: // ug-CN
|
||||
case 2049: // ar-IQ
|
||||
case 2080: // ur-IN
|
||||
case 2118: // pa-Arab-PK
|
||||
case 3073: // ar-EG
|
||||
case 4097: // ar-LY
|
||||
case 5121: // ar-DZ
|
||||
@@ -170,6 +174,7 @@ public class TextInfoTest {
|
||||
case 14337: // ar-AE
|
||||
case 15361: // ar-BH
|
||||
case 16385: // ar-QA
|
||||
case 31814: // pa-Arab
|
||||
case 0x463: // ps-AF
|
||||
Assert.IsTrue (ci.TextInfo.IsRightToLeft, ci.Name);
|
||||
break;
|
||||
|
||||
@@ -68,8 +68,9 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
|
||||
public void Constructor_StringMode ()
|
||||
{
|
||||
string test = "string-filemode";
|
||||
IsolatedStorageFileStream isfs = new IsolatedStorageFileStream (test, FileMode.Create);
|
||||
CheckCommonDetails (test, isfs, true, true);
|
||||
using (var isfs = new IsolatedStorageFileStream (test, FileMode.Create)) {
|
||||
CheckCommonDetails (test, isfs, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -83,8 +84,9 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
|
||||
public void Constructor_StringModeAccess ()
|
||||
{
|
||||
string test = "string-filemode-fileaccess";
|
||||
IsolatedStorageFileStream isfs = new IsolatedStorageFileStream (test, FileMode.Create, FileAccess.ReadWrite);
|
||||
CheckCommonDetails (test, isfs, true, true);
|
||||
using (var isfs = new IsolatedStorageFileStream (test, FileMode.Create, FileAccess.ReadWrite)) {
|
||||
CheckCommonDetails (test, isfs, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -98,22 +100,24 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
|
||||
public void Constructor_StringModeAccessShare ()
|
||||
{
|
||||
string test = "string-filemode-fileaccess-fileshare";
|
||||
IsolatedStorageFileStream isfs = new IsolatedStorageFileStream (test, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||
CheckCommonDetails (test, isfs, false, true);
|
||||
using (var isfs = new IsolatedStorageFileStream (test, FileMode.Create, FileAccess.Write, FileShare.Read)) {
|
||||
CheckCommonDetails (test, isfs, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (IsolatedStorageException))]
|
||||
public void Handle ()
|
||||
{
|
||||
IsolatedStorageFileStream isfs = new IsolatedStorageFileStream ("handle", FileMode.Create);
|
||||
IntPtr p = isfs.Handle;
|
||||
using (var isfs = new IsolatedStorageFileStream ("handle", FileMode.Create)) {
|
||||
IntPtr p = isfs.Handle;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RootPath ()
|
||||
{
|
||||
new IsolatedStorageFileStream ("/rootpath", FileMode.Create);
|
||||
new IsolatedStorageFileStream ("/rootpath", FileMode.Create).Close ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -17,7 +17,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MOBILE
|
||||
using Mono.Unix;
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
@@ -47,7 +47,7 @@ public class DirectoryTest
|
||||
if (Directory.Exists (TempFolder))
|
||||
Directory.Delete (TempFolder, true);
|
||||
}
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MOBILE
|
||||
[Test] //BXC #12461
|
||||
public void EnumerateFilesListSymlinks ()
|
||||
{
|
||||
@@ -1527,7 +1527,23 @@ public class DirectoryTest
|
||||
info = Directory.GetParent (Path.GetPathRoot (Path.GetTempPath ()));
|
||||
Assert.IsNull (info);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void GetDirectoryRoot ()
|
||||
{
|
||||
if (RunningOnUnix)
|
||||
{
|
||||
string path = "/usr/lib";
|
||||
Assert.AreEqual ("/", Directory.GetDirectoryRoot (path));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Ignore ("TODO: no proper implementation on Windows.");
|
||||
string path = "C:\\Windows";
|
||||
Assert.AreEqual ("C:\\", Directory.GetDirectoryRoot (path));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetFiles ()
|
||||
{
|
||||
@@ -1673,6 +1689,20 @@ public class DirectoryTest
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void GetFiles_SubDirInPattern ()
|
||||
{
|
||||
string DirPath = TempFolder + Path.DirectorySeparatorChar + "GetFiles_SubDirInPattern";
|
||||
if (Directory.Exists (DirPath))
|
||||
Directory.Delete (DirPath, true);
|
||||
|
||||
Directory.CreateDirectory ($"{DirPath}{Path.DirectorySeparatorChar}something{Path.DirectorySeparatorChar}else");
|
||||
File.WriteAllText($"{DirPath}{Path.DirectorySeparatorChar}something{Path.DirectorySeparatorChar}else{Path.DirectorySeparatorChar}file", "hello");
|
||||
|
||||
var r = Directory.GetFiles (DirPath, $"something{Path.DirectorySeparatorChar}else{Path.DirectorySeparatorChar}*", SearchOption.AllDirectories);
|
||||
Assert.AreEqual (new string[] { Path.Combine (DirPath, "something", "else", "file") }, r);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
|
||||
@@ -1742,5 +1742,15 @@ namespace MonoTests.System.IO
|
||||
DeleteFile (path);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NamePropertyNormalization ()
|
||||
{
|
||||
string fname = TempFolder + DSC + ".." + DSC + "MonoTests.System.IO.Tests" + DSC + "tfile.txt";
|
||||
|
||||
using (var s = new FileStream (fname, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Delete)) {
|
||||
Assert.AreEqual (TempFolder + DSC + "tfile.txt", s.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,12 @@ public class AssemblyBuilderTest
|
||||
return mb;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultCtor ()
|
||||
{
|
||||
Assert.IsNotNull (ab.Evidence, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void ManifestModule ()
|
||||
|
||||
@@ -506,6 +506,8 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
// The token is not guaranteed to be 0x0a000001
|
||||
[Category ("NotWorking")]
|
||||
public void ResolveFieldMemberRefWithGenericArguments ()
|
||||
{
|
||||
var assembly = genAssembly ();
|
||||
@@ -533,6 +535,8 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
// The token is not guaranteed to be 0x0a000002
|
||||
[Category ("NotWorking")]
|
||||
public void ResolveMethodMemberRefWithGenericArguments ()
|
||||
{
|
||||
var assembly = genAssembly ();
|
||||
@@ -566,6 +570,8 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
// The token is not guaranteed to be 0x2b000001
|
||||
[Category("NotWorking")]
|
||||
public void ResolveMethodSpecWithGenericArguments ()
|
||||
{
|
||||
var assembly = genAssembly ();
|
||||
@@ -794,5 +800,18 @@ namespace MonoTests.System.Reflection.Emit
|
||||
// ArgumentNullException should not occur.
|
||||
module.GetConstructorToken (method, null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetType ()
|
||||
{
|
||||
AssemblyBuilder ab = genAssembly ();
|
||||
ModuleBuilder module = ab.DefineDynamicModule ("foo.dll", "foo.dll");
|
||||
TypeBuilder tb = module.DefineType ("t1", TypeAttributes.Public);
|
||||
|
||||
Assert.AreEqual ("t1[]", module.GetType ("t1[]").FullName);
|
||||
Assert.AreEqual ("t1*", module.GetType ("t1*").FullName);
|
||||
Assert.AreEqual ("t1&", module.GetType ("t1&").FullName);
|
||||
Assert.AreEqual ("t1[]&", module.GetType ("t1[]&").FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
d3115c76913f1792f567eb5069b74d9e4fa77897
|
||||
19be52d9a91b4b96f644a19d9b239df623d3ac66
|
||||
@@ -5,7 +5,7 @@
|
||||
// (C) 2004 Ximian, Inc. http://www.ximian.com
|
||||
//
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
@@ -37,7 +37,7 @@ using System.Configuration.Assemblies;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Threading;
|
||||
@@ -213,7 +213,7 @@ namespace MonoTests.System.Reflection
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC // Reflection.Emit is not supported.
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME // Reflection.Emit is not supported.
|
||||
[Test]
|
||||
[Category("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter
|
||||
public void GetModules_MissingFile ()
|
||||
@@ -265,7 +265,7 @@ namespace MonoTests.System.Reflection
|
||||
public void Corlib_test ()
|
||||
{
|
||||
Assembly corlib_test = Assembly.GetExecutingAssembly ();
|
||||
#if MONODROID || MOBILE_STATIC || __WATCHOS__
|
||||
#if MONODROID || FULL_AOT_DESKTOP || __WATCHOS__
|
||||
Assert.IsNull (corlib_test.EntryPoint, "EntryPoint");
|
||||
Assert.IsNull (corlib_test.Evidence, "Evidence");
|
||||
#elif MOBILE
|
||||
@@ -474,8 +474,8 @@ namespace MonoTests.System.Reflection
|
||||
// with the semantics of aot'ed assembly loading, as
|
||||
// aot may assert when loading. This assumes that it's
|
||||
// safe to greedly load everything.
|
||||
#if MOBILE_STATIC
|
||||
string [] names = { "mobile_static_corlib_test" };
|
||||
#if FULL_AOT_DESKTOP
|
||||
string [] names = { "testing_aot_full_corlib_test", "winaot_corlib_test" };
|
||||
#else
|
||||
string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "net_4_x_corlib_test", "corlib_plattest", "mscorlibtests", "BclTests" };
|
||||
#endif
|
||||
@@ -523,7 +523,7 @@ namespace MonoTests.System.Reflection
|
||||
}
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC // Reflection.Emit is not supported.
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME // Reflection.Emit is not supported.
|
||||
[Test]
|
||||
public void Location_Empty() {
|
||||
string assemblyFileName = Path.Combine (
|
||||
@@ -1146,7 +1146,7 @@ namespace MonoTests.System.Reflection
|
||||
|
||||
Assert.AreEqual ("MonoModule", module.GetType ().Name, "#2");
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
Assert.AreEqual ("mscorlib.dll", module.Name, "#3");
|
||||
#endif
|
||||
Assert.IsFalse (module.IsResource (), "#4");
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -33,7 +33,7 @@ using NUnit.Framework;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -54,7 +54,7 @@ namespace MonoTests.System.Reflection
|
||||
[TestFixture]
|
||||
public class MethodInfoTest
|
||||
{
|
||||
#if MONOTOUCH || MOBILE_STATIC
|
||||
#if MONOTOUCH || FULL_AOT_RUNTIME
|
||||
// use an existing symbol - so we can build without dlsym. It does not matter that the signature does not match for the test
|
||||
[DllImport ("libc", EntryPoint="readlink", CharSet=CharSet.Unicode, ExactSpelling=false, PreserveSig=true, SetLastError=true, BestFitMapping=true, ThrowOnUnmappableChar=true)]
|
||||
#else
|
||||
@@ -115,7 +115,7 @@ namespace MonoTests.System.Reflection
|
||||
DllImportAttribute attr = (DllImportAttribute)((t.GetMethod ("dllImportMethod").GetCustomAttributes (typeof (DllImportAttribute), true)) [0]);
|
||||
|
||||
Assert.AreEqual (CallingConvention.Winapi, attr.CallingConvention, "#1");
|
||||
#if MONOTOUCH || MOBILE_STATIC
|
||||
#if MONOTOUCH || FULL_AOT_RUNTIME
|
||||
Assert.AreEqual ("readlink", attr.EntryPoint, "#2");
|
||||
Assert.AreEqual ("libc", attr.Value, "#3");
|
||||
#else
|
||||
@@ -287,12 +287,28 @@ namespace MonoTests.System.Reflection
|
||||
class GBD_D : GBD_C { public new virtual void f () {} }
|
||||
class GBD_E : GBD_D { public override void f () {} }
|
||||
|
||||
class GBD_E2 : GBD_D { }
|
||||
class GBD_F : GBD_E { }
|
||||
|
||||
|
||||
[Test]
|
||||
public void GetBaseDefinition ()
|
||||
{
|
||||
Assert.AreEqual (typeof (GBD_A), typeof (GBD_C).GetMethod ("f").GetBaseDefinition ().DeclaringType);
|
||||
Assert.AreEqual (typeof (GBD_A), typeof (GBD_C).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#1r");
|
||||
|
||||
Assert.AreEqual (typeof (GBD_D), typeof (GBD_D).GetMethod ("f").GetBaseDefinition ().DeclaringType);
|
||||
Assert.AreEqual (typeof (GBD_D), typeof (GBD_D).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#2r");
|
||||
|
||||
Assert.AreEqual (typeof (GBD_D), typeof (GBD_E).GetMethod ("f").GetBaseDefinition ().DeclaringType);
|
||||
Assert.AreEqual (typeof (GBD_D), typeof (GBD_E).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#3r");
|
||||
|
||||
Assert.AreEqual (typeof (GBD_D), typeof (GBD_E2).GetMethod ("f").GetBaseDefinition ().DeclaringType, "#4");
|
||||
Assert.AreEqual (typeof (GBD_D), typeof (GBD_E2).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#4r");
|
||||
|
||||
Assert.AreEqual (typeof (GBD_D), typeof (GBD_F).GetMethod ("f").GetBaseDefinition ().DeclaringType, "#5");
|
||||
Assert.AreEqual (typeof (GBD_D), typeof (GBD_F).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#5r");
|
||||
|
||||
}
|
||||
|
||||
class GenericBase<T,H> {
|
||||
@@ -397,7 +413,7 @@ namespace MonoTests.System.Reflection
|
||||
[Test]
|
||||
public void GetMethodBody ()
|
||||
{
|
||||
#if (MONOTOUCH || MOBILE_STATIC) && !DEBUG
|
||||
#if (MONOTOUCH || FULL_AOT_RUNTIME) && !DEBUG
|
||||
Assert.Ignore ("Release app (on devices) are stripped of (managed) IL so this test would fail");
|
||||
#endif
|
||||
MethodBody mb = typeof (MethodInfoTest).GetMethod ("locals_method").GetMethodBody ();
|
||||
@@ -600,7 +616,7 @@ namespace MonoTests.System.Reflection
|
||||
} catch (InvalidOperationException ex) {
|
||||
}
|
||||
}
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
public TFoo SimpleGenericMethod2<TFoo, TBar> () { return default (TFoo); }
|
||||
/*Test for the uggly broken behavior of SRE.*/
|
||||
[Test]
|
||||
@@ -854,7 +870,7 @@ namespace MonoTests.System.Reflection
|
||||
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
class GenericClass<T>
|
||||
{
|
||||
public void Method ()
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Runtime.Serialization;
|
||||
@@ -106,7 +106,7 @@ public class ModuleTest
|
||||
}
|
||||
|
||||
// Some of these tests overlap with the tests for ModuleBuilder
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
[Test]
|
||||
[Category("NotDotNet")] // path length can cause suprious failures
|
||||
public void TestGlobalData () {
|
||||
@@ -341,7 +341,7 @@ public class ModuleTest
|
||||
Module m = typeof (ModuleTest).Module;
|
||||
m.GetObjectData (null, new StreamingContext (StreamingContextStates.All));
|
||||
}
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Mono.CompilerServices.SymbolWriter not available for Xamarin.Android
|
||||
public void GetTypes ()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
|
||||
//
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
@@ -31,7 +31,7 @@ using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.IO;
|
||||
@@ -355,7 +355,7 @@ namespace MonoTests.System.Reflection
|
||||
get { return 99; }
|
||||
}
|
||||
}
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
[Test]
|
||||
public void ConstantValue () {
|
||||
/*This test looks scary because we can't generate a default value with C# */
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,36 +24,47 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#if !MONOTOUCH && !MOBILE_STATIC
|
||||
#if !MONOTOUCH && !FULL_AOT_RUNTIME
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
|
||||
namespace MonoTests.System.Reflection.VisibilityTypes
|
||||
{
|
||||
[TestFixture]
|
||||
public class VisibilityTests
|
||||
{
|
||||
static void DoesNotContain (IEnumerable collection, object val)
|
||||
{
|
||||
Assert.That(collection, Has.No.Member(val));
|
||||
}
|
||||
|
||||
static void Contains (IEnumerable collection, object val)
|
||||
{
|
||||
Assert.That(collection, Has.Member(val));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestsExportedTypes ()
|
||||
{
|
||||
var types = typeof (VisibilityTests).Assembly.GetExportedTypes ();
|
||||
|
||||
// Test visibility means that the class is public by applying and on the 'public' visibility of the nested items.
|
||||
CollectionAssert.DoesNotContain (types, typeof (InternalClass));
|
||||
CollectionAssert.Contains (types, typeof (PublicClass));
|
||||
DoesNotContain (types, typeof (InternalClass));
|
||||
Contains (types, typeof (PublicClass));
|
||||
|
||||
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
|
||||
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
|
||||
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
|
||||
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
|
||||
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
|
||||
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
|
||||
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
|
||||
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
|
||||
|
||||
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
|
||||
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
|
||||
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
|
||||
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
|
||||
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
|
||||
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
|
||||
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
|
||||
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -62,18 +73,18 @@ namespace MonoTests.System.Reflection.VisibilityTypes
|
||||
var types = typeof (VisibilityTests).Module.GetTypes ();
|
||||
|
||||
// Test that all the types defined exist.
|
||||
CollectionAssert.Contains (types, typeof (InternalClass));
|
||||
CollectionAssert.Contains (types, typeof (PublicClass));
|
||||
Contains (types, typeof (InternalClass));
|
||||
Contains (types, typeof (PublicClass));
|
||||
|
||||
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
|
||||
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
|
||||
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
|
||||
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
|
||||
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
|
||||
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
|
||||
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
|
||||
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
|
||||
|
||||
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
|
||||
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
|
||||
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
|
||||
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
|
||||
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
|
||||
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
|
||||
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
|
||||
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
|
||||
}
|
||||
|
||||
class InternalClass
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user