X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Ftests%2Ftest-async-11.cs;h=11a02cb83ddcf3e5a10cdedc91be6959e15f1e21;hb=5afd4aa990748d9754b2590d5e50941b2ecb262a;hp=543985e49dfe3507fea3395244d50ed2a3b770d5;hpb=8342b652211b9517ef20e3cac13e3007aeb63694;p=mono.git diff --git a/mcs/tests/test-async-11.cs b/mcs/tests/test-async-11.cs index 543985e49df..11a02cb83dd 100644 --- a/mcs/tests/test-async-11.cs +++ b/mcs/tests/test-async-11.cs @@ -1,5 +1,3 @@ -// Compiler options: -langversion:future - using System; using System.Threading; using System.Threading.Tasks; @@ -24,7 +22,7 @@ class G { T[] a = new T[] { t }; return Call (t, a[0], out t, - await Task.Factory.StartNew (() => 3)); + await Task.Factory.StartNew (() => 3).ConfigureAwait (false)); } int Call (T t1, T t2, out T t3, int i) @@ -39,8 +37,11 @@ class C int field; int prop_value; + int get_called; + int Prop { get { + ++get_called; return prop_value; } set { @@ -71,7 +72,7 @@ class C int v = 9; var array = new ulong[] { ulong.MaxValue }; return new C ().TestCall (ref v, typeof (string), new S () { value = 4 }, array [0], - await Task.Factory.StartNew (() => 3)); + await Task.Factory.StartNew (() => 3).ConfigureAwait (false)); } int TestCall2 (T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7) @@ -83,7 +84,7 @@ class C { short v = 2; return new C ().TestCall2 ((byte) 1, v, value = 9999, float.MaxValue, double.MaxValue, decimal.MaxValue, - await Task.Factory.StartNew (() => 3)); + await Task.Factory.StartNew (() => 3).ConfigureAwait (false)); } static async Task TestStack_3 () @@ -95,13 +96,13 @@ class C s2[0, 0].value = 3; TestCall3 (ref s [0], ref s2 [0, 0], s [0].value++, - await Task.Factory.StartNew (() => 3)); + await Task.Factory.StartNew (() => 3).ConfigureAwait (false)); if (s [0].value != 10) return 1; if (s2 [0, 0].value != 20) - return 1; + return 2; return 0; } @@ -120,7 +121,7 @@ class C var a3 = new [] { new C () }; return TestCall4 (a1[0], a2[0], a3[0], - await Task.Factory.StartNew (() => 3)); + await Task.Factory.StartNew (() => 3).ConfigureAwait (false)); } static int TestCall4 (E e, S s, C c, int i) @@ -141,10 +142,19 @@ class C { var c = new C (); c.prop_value = 7; - c.Prop += await Task.Factory.StartNew (() => { c.prop_value = 99; return 3; }); + c.Prop += await Task.Factory.StartNew (() => { + if (c.get_called != 1) + return -44; + + c.prop_value = 99; + return 3; + }).ConfigureAwait (false); - if (c.prop_value != 10) + if (c.get_called != 1) return 1; + + if (c.prop_value != 109) + return 2; return 0; }