// Gonzalo Paniagua Javier (gonzalo@ximian.com)
// Philippe Lavoie (philippe.lavoie@cactus.ca)
// Sebastien Pouliot (sebastien@ximian.com)
+// Aleksey Kliger (aleksey@xamarin.com)
//
// (c) 2003 Ximian, Inc. (http://www.ximian.com)
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2015, Xamarin, Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
}
[Test] // bug #49114
- [Category ("NotWorking")]
[ExpectedException (typeof (ArgumentException))]
public void GetType_TypeName_Invalid ()
{
typeof (int).Assembly.GetType ("&blabla", true, true);
}
+ [Test] // bug #17571
+ [ExpectedException (typeof (ArgumentException))]
+ public void GetType_Invalid_RefPtr () {
+ typeof (int).Assembly.GetType ("System.Int32&*", true, true);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void GetType_Invalid_RefArray () {
+ typeof (int).Assembly.GetType ("System.Int32&[]", true, true);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void GetType_Invalid_RefGeneric () {
+ typeof (int).Assembly.GetType ("System.Tuple`1&[System.Int32]", true, true);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void GetType_Invalid_PtrGeneric () {
+ typeof (int).Assembly.GetType ("System.Tuple`1*[System.Int32]", true, true);
+ }
+
+ [Test]
+ public void GetType_ComposeModifiers () {
+ var a = typeof(int).Assembly;
+
+ var e1 = typeof (Int32).MakePointerType().MakeByRefType();
+ var t1 = a.GetType ("System.Int32*&", true, true);
+ Assert.AreEqual (e1, t1, "#1");
+
+ var e2 = typeof (Int32).MakeArrayType(2).MakeByRefType();
+ var t2 = a.GetType ("System.Int32[,]&", true, true);
+ Assert.AreEqual (e2, t2, "#2");
+
+ var e3 = typeof (Int32).MakePointerType().MakeArrayType();
+ var t3 = a.GetType ("System.Int32*[]", true, true);
+ Assert.AreEqual (e3, t3, "#3");
+
+ var e4 = typeof (Int32).MakeArrayType().MakePointerType().MakePointerType().MakeArrayType().MakePointerType().MakeByRefType();
+ var t4 = a.GetType ("System.Int32[]**[]*&", true, true);
+ Assert.AreEqual (e4, t4, "#4");
+
+ }
+
[Test] // bug #334203
public void GetType_TypeName_AssemblyName ()
{