You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
3076
mcs/tests/ChangeLog
3076
mcs/tests/ChangeLog
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,7 @@ TEST_PATTERN = 'v2'
|
||||
|
||||
ifeq (net_4_x, $(PROFILE))
|
||||
TEST_PATTERN = 'v4'
|
||||
DEFINES = -compiler-options:"-d:NET_4_0;NET_4_5"
|
||||
DEFINES = -compiler-options:"-d:NET_4_0;NET_4_5 -debug"
|
||||
endif
|
||||
|
||||
LOCAL_RUNTIME_FLAGS = --verify-all
|
||||
|
||||
@@ -27,13 +27,13 @@ class C
|
||||
int TestInstance ()
|
||||
{
|
||||
Expression<Func<EmptyDelegate>> e = () => M;
|
||||
if (e.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, value(C), Void M()))")
|
||||
if (e.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, value(C)))")
|
||||
return 1;
|
||||
|
||||
e.Compile () ();
|
||||
|
||||
Expression<Func<C, EmptyDelegate>> e2 = (l) => l.M;
|
||||
if (e2.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, l, Void M()))")
|
||||
if (e2.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, l))")
|
||||
return 2;
|
||||
|
||||
e2.Compile () (this);
|
||||
@@ -43,8 +43,7 @@ class C
|
||||
public static int Main ()
|
||||
{
|
||||
Expression<Func<EmptyDelegate>> e = () => new EmptyDelegate (Test);
|
||||
|
||||
if (e.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, null, Void Test()))")
|
||||
if (e.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null))")
|
||||
return 1;
|
||||
|
||||
var v = e.Compile ();
|
||||
@@ -54,7 +53,7 @@ class C
|
||||
return 2;
|
||||
|
||||
Expression<Func<EmptyDelegate>> e2 = () => Test;
|
||||
if (e2.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, null, Void Test()))")
|
||||
if (e2.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null))")
|
||||
return 3;
|
||||
|
||||
var v2 = e2.Compile ();
|
||||
@@ -65,7 +64,7 @@ class C
|
||||
|
||||
unsafe {
|
||||
Expression<Func<UnsafeDelegate>> e3 = () => new UnsafeDelegate (Foo);
|
||||
if (e3.Body.ToString () != "Convert(CreateDelegate(UnsafeDelegate, null, Int32* Foo()))")
|
||||
if (e3.Body.ToString () != "Convert(Int32* Foo().CreateDelegate(UnsafeDelegate, null))")
|
||||
return 5;
|
||||
|
||||
var v3 = e3.Compile ();
|
||||
|
||||
31
mcs/tests/gtest-etree-31.cs
Normal file
31
mcs/tests/gtest-etree-31.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
class X
|
||||
{
|
||||
class HasAction
|
||||
{
|
||||
public void Start ()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
var expectedObject = typeof (HasAction).GetMethod("Start");
|
||||
|
||||
Expression<Func<HasAction, Action>> methodToUse = r => r.Start;
|
||||
|
||||
UnaryExpression unary = methodToUse.Body as UnaryExpression;
|
||||
MethodCallExpression methodCall = unary.Operand as MethodCallExpression;
|
||||
ConstantExpression constantExpression = methodCall.Object as ConstantExpression;
|
||||
|
||||
if (expectedObject != constantExpression.Value)
|
||||
return 1;
|
||||
|
||||
if (methodCall.Object == null)
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
38
mcs/tests/gtest-lambda-37.cs
Normal file
38
mcs/tests/gtest-lambda-37.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
|
||||
public class MainClass
|
||||
{
|
||||
static long? X<T> (T a1, Func<T, T?> a2) where T : struct
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int? X<T> (T a1, Func<T, int?> a2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static double? X<T> (T a1, Func<T, double?> a2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
int? sum = X<int> (1, i => {
|
||||
if (i > 0)
|
||||
return i;
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
int? sum2 = X (1, i => {
|
||||
if (i > 0)
|
||||
return i;
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -104,10 +104,10 @@ public class Program
|
||||
if (Test_5 () != 0)
|
||||
return 5;
|
||||
|
||||
if (Test_6 () != 0)
|
||||
if (Test_6 () != 1)
|
||||
return 6;
|
||||
|
||||
if (Test_7 (false) != 0)
|
||||
if (Test_7 (false) != 1)
|
||||
return 7;
|
||||
|
||||
if (Test_8 (typeof (bool)) != 0)
|
||||
|
||||
66
mcs/tests/gtest-optional-36.cs
Normal file
66
mcs/tests/gtest-optional-36.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
|
||||
public class Program
|
||||
{
|
||||
static int Arg (uint a, long b)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int Arg (int a, ulong b, int c = 9)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
static int Arg_2 (uint a, long b, params int[] arg)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int Arg_2 (int a, ulong b, int c = 0)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
static int Arg_3 (int a, long b, params int[] arg)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int Arg_3 (uint a, ulong b, int c = 0, int d = 1, params int[] oo)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
if (Arg (0, 0) != 2)
|
||||
return 1;
|
||||
|
||||
if (Arg (0, 0, 0) != 3)
|
||||
return 2;
|
||||
|
||||
if (Arg_2 (0, 0) != 3)
|
||||
return 3;
|
||||
|
||||
if (Arg_2 (0, 0, 0, 0) != 2)
|
||||
return 4;
|
||||
|
||||
if (Arg_3 (0, 0) != 2)
|
||||
return 5;
|
||||
|
||||
if (Arg_3 (0, 0, 0) != 2)
|
||||
return 6;
|
||||
|
||||
if (Arg_3 (0, 0, 0, 0) != 2)
|
||||
return 7;
|
||||
|
||||
if (Arg_3 (0, 0, 0, 0, 0) != 2)
|
||||
return 8;
|
||||
|
||||
if (Arg_3 (0, 0, 0, 0, 0) != 2)
|
||||
return 9;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
19
mcs/tests/gtest-optional-37.cs
Normal file
19
mcs/tests/gtest-optional-37.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
class Test1
|
||||
{
|
||||
static object Foo (int arg = 1, int arg2 = 2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
static object Foo (object arg, object arg2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
Func<int, int, object> o = Foo;
|
||||
}
|
||||
}
|
||||
36
mcs/tests/gtest-optional-38.cs
Normal file
36
mcs/tests/gtest-optional-38.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
class C
|
||||
{
|
||||
}
|
||||
|
||||
class Foo
|
||||
{
|
||||
public int SetValue (string name, string value, string defaultValue = null, bool preserveExistingCase = false)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int SetValue (string name, C value, C defaultValue = default(C), bool relativeToProject = true, C relativeToPath = default(C), bool mergeToMainGroup = false, string condition = null)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int SetValue (string name, object value, C defaultValue = null)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
class Test
|
||||
{
|
||||
static int Main()
|
||||
{
|
||||
var f = new Foo ();
|
||||
C b = null;
|
||||
C c = null;
|
||||
|
||||
if (f.SetValue ("a", b, c) != 2)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
25
mcs/tests/gtest-optional-39.cs
Normal file
25
mcs/tests/gtest-optional-39.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
class A
|
||||
{
|
||||
public int GetValues (string[] s, string value = null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int GetValues (string s, params string [] args)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class B
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
var a = new A ();
|
||||
if (a.GetValues (null) != 1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,9 @@ class X
|
||||
if (fvi.FileVersion != "2011.02.0.0")
|
||||
return 1;
|
||||
|
||||
if (fvi.ProductVersion != "2011.02.0.0")
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
22
mcs/tests/test-933.cs
Normal file
22
mcs/tests/test-933.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
class X
|
||||
{
|
||||
static int Foo (params X[] p)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int Foo (object p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int Main ()
|
||||
{
|
||||
if (Foo ((X[]) null) != 1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
22
mcs/tests/test-934.cs
Normal file
22
mcs/tests/test-934.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
class X
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
var a = new byte[] { };
|
||||
var b = new byte[] { };
|
||||
if (a.Equals (b))
|
||||
return 1;
|
||||
|
||||
if (ReferenceEquals (a, b))
|
||||
return 2;
|
||||
|
||||
b = new byte[0];
|
||||
if (a.Equals (b))
|
||||
return 3;
|
||||
|
||||
if (ReferenceEquals (a, b))
|
||||
return 4;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
95
mcs/tests/test-935.cs
Normal file
95
mcs/tests/test-935.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
public static class Program
|
||||
{
|
||||
public delegate void DelegateVoid (int arg);
|
||||
public delegate int DelegateInt (string arg);
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
Foo (Bar);
|
||||
|
||||
TT (null);
|
||||
NN (0);
|
||||
NN2 (1);
|
||||
Complex (null);
|
||||
MM (1);
|
||||
MM ((byte) 1);
|
||||
DecimalRule (() => (byte) 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void TT (Task<string> a)
|
||||
{
|
||||
}
|
||||
|
||||
static void TT (Task<object> b)
|
||||
{
|
||||
throw new ApplicationException ("wrong overload");
|
||||
}
|
||||
|
||||
static void NN (sbyte a)
|
||||
{
|
||||
}
|
||||
|
||||
static void NN (uint? b)
|
||||
{
|
||||
throw new ApplicationException ("wrong overload");
|
||||
}
|
||||
|
||||
static void NN2 (sbyte? a)
|
||||
{
|
||||
}
|
||||
|
||||
static void NN2 (uint? b)
|
||||
{
|
||||
throw new ApplicationException ("wrong overload");
|
||||
}
|
||||
|
||||
public static void Bar (int arg)
|
||||
{
|
||||
}
|
||||
|
||||
public static int Bar (string arg)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static void Foo (DelegateVoid input)
|
||||
{
|
||||
throw new ApplicationException ("wrong overload");
|
||||
}
|
||||
|
||||
public static void Foo (DelegateInt input)
|
||||
{
|
||||
}
|
||||
|
||||
static void Complex (Expression<Func<Task<short>>> arg)
|
||||
{
|
||||
}
|
||||
|
||||
static void Complex (Expression<Func<Task<ulong>>> arg)
|
||||
{
|
||||
throw new ApplicationException ("wrong overload");
|
||||
}
|
||||
|
||||
static void MM (double f)
|
||||
{
|
||||
}
|
||||
|
||||
static void MM (double? f)
|
||||
{
|
||||
throw new ApplicationException ("wrong overload");
|
||||
}
|
||||
|
||||
static void DecimalRule (Func<int> i)
|
||||
{
|
||||
}
|
||||
|
||||
static void DecimalRule (Func<decimal?> i)
|
||||
{
|
||||
throw new ApplicationException ("wrong overload");
|
||||
}
|
||||
}
|
||||
45
mcs/tests/test-936-lib.il
Normal file
45
mcs/tests/test-936-lib.il
Normal file
@@ -0,0 +1,45 @@
|
||||
.assembly extern mscorlib
|
||||
{
|
||||
}
|
||||
|
||||
.assembly 'test-936-lib'
|
||||
{
|
||||
}
|
||||
|
||||
.class public auto ansi sealed beforefieldinit TypeWithIndexer
|
||||
extends [mscorlib]System.Object
|
||||
{
|
||||
.custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) // ...Item..
|
||||
|
||||
.method public hidebysig specialname rtspecialname
|
||||
instance void .ctor() cil managed
|
||||
{
|
||||
IL_0000: ldarg.0
|
||||
IL_0001: call instance void [mscorlib]System.Object::.ctor()
|
||||
IL_0006: ret
|
||||
}
|
||||
|
||||
.field private uint8[] a
|
||||
.field private int32 b
|
||||
.method public hidebysig specialname instance uint8
|
||||
get_B(int32 index) cil managed
|
||||
{
|
||||
IL_0000: ldc.i4.0
|
||||
IL_0001: conv.u1
|
||||
IL_0002: ret
|
||||
}
|
||||
|
||||
.method public hidebysig specialname
|
||||
instance void set_O(int32 index,
|
||||
uint8 A_1) cil managed
|
||||
{
|
||||
IL_0000: ret
|
||||
}
|
||||
|
||||
.property instance uint8 Item(int32)
|
||||
{
|
||||
.get instance uint8 TypeWithIndexer::get_B(int32)
|
||||
.set instance void TypeWithIndexer::set_O(int32,
|
||||
uint8)
|
||||
}
|
||||
}
|
||||
11
mcs/tests/test-936.cs
Normal file
11
mcs/tests/test-936.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
// Compiler options: -r:test-936-lib.dll
|
||||
|
||||
class X
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
TypeWithIndexer a = new TypeWithIndexer ();
|
||||
var x = a[0];
|
||||
a[0] = x;
|
||||
}
|
||||
}
|
||||
13
mcs/tests/test-938.cs
Normal file
13
mcs/tests/test-938.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Example
|
||||
{
|
||||
public class A : A.InnerInterface
|
||||
{
|
||||
public interface InnerInterface
|
||||
{
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,17 @@ class Tester : Base
|
||||
return total - 6;
|
||||
}
|
||||
|
||||
async Task<int> Foreach_2 ()
|
||||
{
|
||||
int total = 0;
|
||||
foreach (var e in await Task.Factory.StartNew (() => new List<int> () { 1, 2, 3 }).ConfigureAwait (false)) {
|
||||
await Task.Yield ();
|
||||
total += e;
|
||||
}
|
||||
|
||||
return total - 6;
|
||||
}
|
||||
|
||||
static bool RunTest (MethodInfo test)
|
||||
{
|
||||
Console.Write ("Running test {0, -25}", test.Name);
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
class C
|
||||
{
|
||||
static ManualResetEvent caught = new ManualResetEvent (false);
|
||||
|
||||
static async void Test (ManualResetEvent mre)
|
||||
{
|
||||
var a = Task.Factory.StartNew (() => {
|
||||
if (mre.WaitOne (1000))
|
||||
throw new ApplicationException ();
|
||||
});
|
||||
|
||||
await a.ConfigureAwait (false);
|
||||
}
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
ManualResetEvent mre = new ManualResetEvent (false);
|
||||
Test (mre);
|
||||
|
||||
var handler = new UnhandledExceptionEventHandler (CurrentDomain_UnhandledException);
|
||||
AppDomain.CurrentDomain.UnhandledException += handler;
|
||||
try {
|
||||
mre.Set ();
|
||||
|
||||
if (!caught.WaitOne (1000))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
} finally {
|
||||
AppDomain.CurrentDomain.UnhandledException -= handler;
|
||||
}
|
||||
}
|
||||
|
||||
static void CurrentDomain_UnhandledException (object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (e.ExceptionObject is ApplicationException)
|
||||
caught.Set ();
|
||||
}
|
||||
}
|
||||
74
mcs/tests/test-async-85.cs
Normal file
74
mcs/tests/test-async-85.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
class Program
|
||||
{
|
||||
static int count;
|
||||
|
||||
static int Main ()
|
||||
{
|
||||
Test (false).Wait ();
|
||||
Console.WriteLine (count);
|
||||
if (count != 110011)
|
||||
return 1;
|
||||
|
||||
count = 0;
|
||||
Test (true).Wait ();
|
||||
Console.WriteLine (count);
|
||||
if (count != 111101)
|
||||
return 2;
|
||||
|
||||
count = 0;
|
||||
Test2 (false).Wait ();
|
||||
Console.WriteLine (count);
|
||||
if (count != 11)
|
||||
return 3;
|
||||
|
||||
count = 0;
|
||||
Test2 (true).Wait ();
|
||||
Console.WriteLine (count);
|
||||
if (count != 1101)
|
||||
return 4;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static async Task Test (bool throwTest)
|
||||
{
|
||||
try {
|
||||
count += 1;
|
||||
await Task.Delay (10);
|
||||
|
||||
if (throwTest)
|
||||
throw new ApplicationException ();
|
||||
|
||||
count += 10;
|
||||
} catch (ApplicationException) {
|
||||
count += 100;
|
||||
await Task.Delay (10);
|
||||
count += 1000;
|
||||
} finally {
|
||||
count += 10000;
|
||||
await Task.Delay (10);
|
||||
count += 100000;
|
||||
}
|
||||
}
|
||||
|
||||
static async Task Test2 (bool throwTest)
|
||||
{
|
||||
try {
|
||||
count += 1;
|
||||
await Task.Delay (10);
|
||||
|
||||
if (throwTest)
|
||||
throw new ApplicationException ();
|
||||
|
||||
count += 10;
|
||||
} catch (ApplicationException) {
|
||||
count += 100;
|
||||
await Task.Delay (10);
|
||||
count += 1000;
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user