summaryrefslogtreecommitdiff
path: root/mcs/tests/test-async-54.cs
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/tests/test-async-54.cs')
-rw-r--r--mcs/tests/test-async-54.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/mcs/tests/test-async-54.cs b/mcs/tests/test-async-54.cs
new file mode 100644
index 0000000000..ab10233198
--- /dev/null
+++ b/mcs/tests/test-async-54.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+class Test
+{
+ public static int Main ()
+ {
+ int res;
+ res = TestMethod (new TaskCanceledException ()).Result;
+ if (res != 0)
+ return 10 * res;
+
+ res = TestMethod (new OperationCanceledException ("my message")).Result;
+ if (res != 0)
+ return 20 * res;
+
+ return 0;
+ }
+
+ async static Task<int> TestMethod (Exception ex)
+ {
+ try {
+ await Foo (ex);
+ } catch (OperationCanceledException e) {
+ if (e == ex)
+ return 0;
+
+ return 1;
+ }
+
+ return 2;
+ }
+
+
+ async static Task Foo (Exception e)
+ {
+ await Task.Delay (1);
+ throw e;
+ }
+} \ No newline at end of file