Merge pull request #3204 from BrzVlad/fix-lock-free-alloc2
[mono.git] / mcs / class / System / Test / Microsoft.CSharp / CodeGeneratorFromTypeTest.cs
index ea56e4ebd29e8cc6c4cfe594b736f9b132314373..42a42146a3e47507d1320ecd1a3e4d159db4df51 100644 (file)
@@ -110,11 +110,7 @@ namespace MonoTests.Microsoft.CSharp
                {
                        string code = GenerateDerivedType (Options);
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
-#if NET_2_0
                                "internal abstract class Test1 : int, System.Security.Principal.IIdentity, string, System.Security.IPermission {{{0}" +
-#else
-                               "abstract class Test1 : int, System.Security.Principal.IIdentity, string, System.Security.IPermission {{{0}" +
-#endif
                                "}}{0}", NewLine), code);
                }
 
@@ -160,11 +156,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public class Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal event int Click;{0}" +
-#else
-                               "    /*FamANDAssem*/ internal event int Click;{0}" +
-#endif
                                "}}{0}", NewLine), code);
                }
 
@@ -331,11 +323,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public class Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal virtual int Name {{{0}" +
-#else
-                               "    internal int Name {{{0}" +
-#endif
                                "        set {{{0}" +
                                "        }}{0}" +
                                "    }}{0}" +
@@ -404,11 +392,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public class Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal virtual int Name {{{0}" +
-#else
-                               "    internal int Name {{{0}" +
-#endif
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
                }
@@ -664,11 +648,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public class Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal virtual int Execute() {{{0}" +
-#else
-                               "    internal int Execute() {{{0}" +
-#endif
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
                }
@@ -680,11 +660,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public class Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal virtual int Execute() {{{0}" +
-#else
-                               "    internal int Execute() {{{0}" +
-#endif
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
                }
@@ -755,6 +731,18 @@ namespace MonoTests.Microsoft.CSharp
                                "}}{0}", NewLine), code);
                }
 
+               [Test]
+               public override void MethodParamArrayAttribute ()
+               {
+                       string code = GenerateMethodParamArrayAttribute (Options);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "public class Test1 {{{0}" +
+                               "    {0}" +
+                               "    public virtual int Something([A()] [B()] params out object value, [C()] ref int ) {{{0}" +
+                               "    }}{0}" +
+                               "}}{0}", NewLine), code);
+               }
+
                [Test]
                public override void MethodReturnTypeAttributes ()
                {
@@ -764,8 +752,10 @@ namespace MonoTests.Microsoft.CSharp
                                "    {0}" +
                                "    [A()]{0}" +
                                "    [B()]{0}" +
+                               "    params{0}" +
                                "    [return: C(A1=false, A2=true)]{0}" +
                                "    [return: D()]{0}" +
+                               "    return: params{0}" +
                                "    public virtual int Execute() {{{0}" +
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
@@ -901,10 +891,8 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public class Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    [A()]{0}" +
                                "    [B()]{0}" +
-#endif
                                "    static Test1() {{{0}" +
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
@@ -921,10 +909,8 @@ namespace MonoTests.Microsoft.CSharp
                                "public class Test1{0}" + 
                                "{{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    [A()]{0}" +
                                "    [B()]{0}" +
-#endif
                                "    static Test1(){0}" + 
                                "    {{{0}" +
                                "    }}{0}" +
@@ -938,12 +924,8 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public class Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    [A()]{0}" +
                                "    public static int Main() {{{0}" +
-#else
-                               "    public static void Main() {{{0}" +
-#endif
                                "        Test.InnerType x;{0}" +
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
@@ -969,7 +951,6 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.IsTrue (sw.ToString ().IndexOf ("@default") > 0);
                }
 
-#if NET_2_0
                [Test]
                public void GenericCodeTypeReferencesTest ()
                {
@@ -982,9 +963,7 @@ namespace MonoTests.Microsoft.CSharp
                                "    private System.Nullable<> Bar;{0}" +
                                "}}{0}", NewLine), code);
                }
-#endif
                
-#if NET_2_0
                [Test]
                public override void PartialTypeTest ()
                {
@@ -993,7 +972,6 @@ namespace MonoTests.Microsoft.CSharp
                                "public partial class Test1 {{{0}" +
                                "}}{0}", NewLine), code);
                }
-#endif
        }
 
        [TestFixture]
@@ -1382,6 +1360,14 @@ namespace MonoTests.Microsoft.CSharp
                                "public delegate void Test1();{0}{0}", NewLine), code);
                }
 
+               [Test]
+               public override void MethodParamArrayAttribute ()
+               {
+                       string code = GenerateMethodParamArrayAttribute (Options);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "public delegate void Test1();{0}{0}", NewLine), code);
+               }
+
                [Test]
                public override void MethodReturnTypeAttributes ()
                {
@@ -1468,17 +1454,12 @@ namespace MonoTests.Microsoft.CSharp
                        string code = GenerateEntryPointMethod (Options);
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public delegate void Test1();{0}{0}" +
-#if NET_2_0
                                "[A()]{0}" +
                                "public static int Main() {{{0}" +
-#else
-                               "public static void Main() {{{0}" +
-#endif
                                "    Test.InnerType x;{0}" +
                                "}}{0}", NewLine), code);
                }
 
-#if NET_2_0
                [Test]
                public override void PartialTypeTest ()
                {
@@ -1487,7 +1468,6 @@ namespace MonoTests.Microsoft.CSharp
                                "public delegate void Test1();{0}"
                                , NewLine), code);
                }
-#endif
                
                #endregion Override implementation of CodeGeneratorFromTypeTestBase
        }
@@ -1581,11 +1561,7 @@ namespace MonoTests.Microsoft.CSharp
                {
                        string code = GenerateDerivedType (Options);
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
-#if NET_2_0
                                "internal interface Test1 : int, System.Security.Principal.IIdentity, string, System.Security.IPermission {{{0}" +
-#else
-                               "interface Test1 : int, System.Security.Principal.IIdentity, string, System.Security.IPermission {{{0}" +
-#endif
                                "}}{0}", NewLine), code);
                }
 
@@ -1631,11 +1607,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public interface Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal event int Click;{0}" +
-#else
-                               "    /*FamANDAssem*/ internal event int Click;{0}" +
-#endif
                                "}}{0}", NewLine), code);
                }
 
@@ -2089,6 +2061,17 @@ namespace MonoTests.Microsoft.CSharp
                                "}}{0}", NewLine), code);
                }
 
+               [Test]
+               public override void MethodParamArrayAttribute ()
+               {
+                       string code = GenerateMethodParamArrayAttribute (Options);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "public interface Test1 {{{0}" +
+                               "    {0}" +
+                               "    int Something([A()] [B()] params out object value, [C()] ref int );{0}" +
+                               "}}{0}", NewLine), code);
+               }
+
                [Test]
                public override void MethodReturnTypeAttributes ()
                {
@@ -2098,8 +2081,10 @@ namespace MonoTests.Microsoft.CSharp
                                "    {0}" +
                                "    [A()]{0}" +
                                "    [B()]{0}" +
+                               "    params{0}" +
                                "    [return: C(A1=false, A2=true)]{0}" +
                                "    [return: D()]{0}" +
+                               "    return: params{0}" +
                                "    int Execute();{0}" +
                                "}}{0}", NewLine), code);
                }
@@ -2230,18 +2215,13 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public interface Test1 {{{0}" + 
                                "    {0}" +
-#if NET_2_0
                                "    [A()]{0}" +
                                "    public static int Main() {{{0}" +
-#else
-                               "    public static void Main() {{{0}" +
-#endif
                                "        Test.InnerType x;{0}" +
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
                }
 
-#if NET_2_0
                [Test]
                public override void PartialTypeTest ()
                {
@@ -2250,7 +2230,6 @@ namespace MonoTests.Microsoft.CSharp
                                "public partial interface Test1 {{{0}" +
                                "}}{0}", NewLine), code);
                }
-#endif
                #endregion Override implementation of CodeGeneratorFromTypeTestBase
        }
 
@@ -2343,11 +2322,7 @@ namespace MonoTests.Microsoft.CSharp
                {
                        string code = GenerateDerivedType (Options);
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
-#if NET_2_0
                                "internal struct Test1 : int, System.Security.Principal.IIdentity, string, System.Security.IPermission {{{0}" +
-#else
-                               "struct Test1 : int, System.Security.Principal.IIdentity, string, System.Security.IPermission {{{0}" +
-#endif
                                "}}{0}", NewLine), code);
                }
 
@@ -2393,11 +2368,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public struct Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal event int Click;{0}" +
-#else
-                               "    /*FamANDAssem*/ internal event int Click;{0}" +
-#endif
                                "}}{0}", NewLine), code);
                }
 
@@ -2509,11 +2480,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public struct Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal virtual int Name {{{0}" +
-#else
-                               "    internal int Name {{{0}" +
-#endif
                                "        set {{{0}" +
                                "        }}{0}" +
                                "    }}{0}" +
@@ -2582,11 +2549,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public struct Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal virtual int Name {{{0}" +
-#else
-                               "    internal int Name {{{0}" +
-#endif
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
                }
@@ -2818,11 +2781,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public struct Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal virtual int Execute() {{{0}" +
-#else
-                               "    internal int Execute() {{{0}" +
-#endif
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
                }
@@ -2834,11 +2793,7 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public struct Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    internal virtual int Execute() {{{0}" +
-#else
-                               "    internal int Execute() {{{0}" +
-#endif
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
                }
@@ -2897,6 +2852,18 @@ namespace MonoTests.Microsoft.CSharp
                                "}}{0}", NewLine), code);
                }
 
+               [Test]
+               public override void MethodParamArrayAttribute ()
+               {
+                       string code = GenerateMethodParamArrayAttribute (Options);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "public struct Test1 {{{0}" +
+                               "    {0}" +
+                               "    public virtual int Something([A()] [B()] params out object value, [C()] ref int ) {{{0}" +
+                               "    }}{0}" +
+                               "}}{0}", NewLine), code);
+               }
+
                [Test]
                public override void MethodReturnTypeAttributes ()
                {
@@ -2906,8 +2873,10 @@ namespace MonoTests.Microsoft.CSharp
                                "    {0}" +
                                "    [A()]{0}" +
                                "    [B()]{0}" +
+                               "    params{0}" +
                                "    [return: C(A1=false, A2=true)]{0}" +
                                "    [return: D()]{0}" +
+                               "    return: params{0}" +
                                "    public virtual int Execute() {{{0}" +
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
@@ -3043,10 +3012,8 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public struct Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    [A()]{0}" +
                                "    [B()]{0}" +
-#endif
                                "    static Test1() {{{0}" +
                                "    }}{0}" +
                                "}}{0}", NewLine), code, "#1");
@@ -3063,10 +3030,8 @@ namespace MonoTests.Microsoft.CSharp
                                "public struct Test1{0}" +
                                "{{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    [A()]{0}" +
                                "    [B()]{0}" +
-#endif
                                "    static Test1(){0}" + 
                                "    {{{0}" +
                                "    }}{0}" +
@@ -3080,18 +3045,13 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public struct Test1 {{{0}" +
                                "    {0}" +
-#if NET_2_0
                                "    [A()]{0}" +
                                "    public static int Main() {{{0}" +
-#else
-                               "    public static void Main() {{{0}" +
-#endif
                                "        Test.InnerType x;{0}" +
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
                }
 
-#if NET_2_0
                [Test]
                public override void PartialTypeTest ()
                {
@@ -3100,7 +3060,6 @@ namespace MonoTests.Microsoft.CSharp
                                "public partial struct Test1 {{{0}" +
                                "}}{0}", NewLine), code);
                }
-#endif
                #endregion Override implementation of CodeGeneratorFromTypeTestBase
        }
 
@@ -3193,11 +3152,7 @@ namespace MonoTests.Microsoft.CSharp
                {
                        string code = GenerateDerivedType (Options);
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
-#if NET_2_0
                                "internal enum Test1 : int, System.Security.Principal.IIdentity, string, System.Security.IPermission {{{0}" +
-#else
-                               "enum Test1 : int, System.Security.Principal.IIdentity, string, System.Security.IPermission {{{0}" +
-#endif
                                "}}{0}", NewLine), code);
                }
 
@@ -3618,6 +3573,16 @@ namespace MonoTests.Microsoft.CSharp
                                "}}{0}", NewLine), code);
                }
 
+               [Test]
+               public override void MethodParamArrayAttribute ()
+               {
+                       string code = GenerateMethodParamArrayAttribute (Options);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "public enum Test1 {{{0}" +
+                               "    {0}" +
+                               "}}{0}", NewLine), code);
+               }
+
                [Test]
                public override void MethodReturnTypeAttributes ()
                {
@@ -3743,18 +3708,13 @@ namespace MonoTests.Microsoft.CSharp
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "public enum Test1 {{{0}" + 
                                "    {0}" +
-#if NET_2_0
                                "    [A()]{0}" +
                                "    public static int Main() {{{0}" +
-#else
-                               "    public static void Main() {{{0}" +
-#endif
                                "        Test.InnerType x;{0}" +
                                "    }}{0}" +
                                "}}{0}", NewLine), code);
                }
 
-#if NET_2_0
                [Test]
                public override void PartialTypeTest ()
                {
@@ -3763,7 +3723,6 @@ namespace MonoTests.Microsoft.CSharp
                                "public enum Test1 {{{0}" +
                                "}}{0}", NewLine), code);
                }
-#endif
                
                #endregion Override implementation of CodeGeneratorFromTypeTestBase
        }