OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // VMOptions=--no_show_internal_names | 4 // VMOptions=--no_show_internal_names |
| 5 // |
5 // Dart test program testing type casts. | 6 // Dart test program testing type casts. |
6 import "package:expect/expect.dart"; | |
7 | 7 |
8 // Test that the initializer expression gets properly skipped. | 8 // Test that the initializer expression gets properly skipped. |
9 bool b = "foo" as double; | 9 bool b = "foo" as double; |
10 | 10 |
11 class TypeTest { | 11 class TypeTest { |
12 static test() { | 12 static test() { |
13 int result = 0; | 13 int result = 0; |
14 try { | 14 try { |
15 var i = "hello" as int; // Throws a CastError | 15 var i = "hello" as int; // Throws a CastError |
16 } on TypeError catch (error) { | 16 } on TypeError catch (error) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 Expect.equals(1, testReturn()); | 153 Expect.equals(1, testReturn()); |
154 Expect.equals(1, testField()); | 154 Expect.equals(1, testField()); |
155 Expect.equals(1, testAnyFunction()); | 155 Expect.equals(1, testAnyFunction()); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 | 159 |
160 main() { | 160 main() { |
161 TypeTest.testMain(); | 161 TypeTest.testMain(); |
162 } | 162 } |
OLD | NEW |