Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / debug-casts.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Runtime.CompilerServices;
4
5 public class Tests
6 {
7         public static int Main (string[] args) {
8                 return TestDriver.RunTests (typeof (Tests), args);
9         }
10
11         public static int test_0_simple () {
12                 object o = new object ();
13                 try {
14                         string s = (string)o;
15                         return 1;
16                 } catch (InvalidCastException ex) {
17                         if (!ex.Message.Contains ("System.Object") || !ex.Message.Contains ("System.String"))
18                                 return 2;
19                 }
20                 return 0;
21         }
22
23         public static int test_0_complex_1 () {
24                 object o = new object ();
25                 try {
26                         IEnumerable<object> ie = (IEnumerable<object>)o;
27                         return 1;
28                 } catch (InvalidCastException ex) {
29                         if (!ex.Message.Contains ("System.Object") || !ex.Message.Contains ("System.Collections.Generic.IEnumerable`1[System.Object]"))
30                                 return 2;
31                 }
32                 return 0;
33         }
34
35         [MethodImplAttribute (MethodImplOptions.NoInlining)]
36         public static object return_null () {
37                 return null;
38         }
39
40         public static int test_0_complex_1_null () {
41                 object o = return_null ();
42                 IEnumerable<object> ie = (IEnumerable<object>)o;
43                 return 0;
44         }
45 }