import source from 1.3.40
[external/swig.git] / Examples / test-suite / csharp / exception_order_runme.cs
1 using System;
2 using exception_orderNamespace;
3
4 public class runme {
5   static void Main() {
6     A a = new A();
7
8     try {
9       a.foo();
10       throw new Exception("missed exception");
11     } catch (ApplicationException e) {
12       if (e.Message != "C++ E1 exception thrown")
13         throw new ApplicationException("bad exception order: " + e.Message);
14     }
15
16     try {
17       a.bar();
18       throw new Exception("missed exception");
19     } catch (ApplicationException e) {
20       if (e.Message != "C++ E2 exception thrown")
21         throw new ApplicationException("bad exception order: " + e.Message);
22     }
23
24     try {
25       a.foobar();
26       throw new Exception("missed exception");
27     } catch (ApplicationException e) {
28       if (e.Message != "postcatch unknown")
29         throw new ApplicationException("bad exception order: " + e.Message);
30     }
31
32     try {
33       a.barfoo(1);
34       throw new Exception("missed exception");
35     } catch (ApplicationException e) {
36       if (e.Message != "C++ E1 exception thrown")
37         throw new ApplicationException("bad exception order: " + e.Message);
38     }
39
40     try {
41       a.barfoo(2);
42       throw new Exception("missed exception");
43     } catch (ApplicationException e) {
44       if (e.Message != "C++ E2 * exception thrown")
45         throw new ApplicationException("bad exception order: " + e.Message);
46     }
47   }
48 }