added kerning support to record device
[swftools.git] / lib / as3 / ok / finally.as
1 package {
2     import flash.display.MovieClip;
3
4     public class Main extends flash.display.MovieClip {
5         function test_return() {
6             try {
7                 return;
8                 trace("error");
9             } finally {
10                 trace("ok 1/9");
11             }
12             trace("error");
13         }
14         
15         function test_break() {
16             do {
17                 try {
18                     break;
19                     trace("error");
20                 } finally {
21                     trace("ok 2/9");
22                 }
23                 trace("error");
24             } while(true);
25         }
26         
27         function test_fallthrough() {
28             try {
29                 var x = 1+1;
30             } finally {
31                 trace("ok 3/9");
32             }
33         }
34         
35         function test_exception() {
36             try {
37                 try {
38                     throw new Error();
39                     trace("error");
40                 } finally {
41                     trace("ok 4/9");
42                 }
43                 trace("error");
44             } catch(e:Error) {
45                 trace("ok 5/9");
46             }
47         }
48         
49         function test_exception2() {
50             var x:int = 0;
51             try {
52                 throw new Error();
53                 trace("error");
54             } catch(e:Error) {
55                 x=1;
56             } finally {
57                 x++;
58             }
59             if(x==2)
60                 trace("ok 6/9");
61         }
62
63         function fail1() {
64             try {
65                 throw new Error();
66             } finally {
67                 trace("ok 7/9");
68             }
69         }
70         
71         function fail2() {
72             try {
73                 fail1();
74             } finally {
75                 trace("ok 8/9");
76             }
77         }
78         
79         function test_exception3() {
80             try {
81                 fail2();
82             } catch(e:Error) {
83                 trace("ok 9/9");
84             }
85         }
86
87         function Main() {
88             test_return();
89             test_break();
90             test_fallthrough();
91             test_exception();
92             test_exception2();
93             test_exception3();
94             trace("[exit]");
95         }
96     }
97 }