| 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 // |
| 6 // Dart test program testing type casts. | 6 // Dart test program testing type casts. |
| 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 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return result; | 31 return result; |
| 32 } | 32 } |
| 33 | 33 |
| 34 static testSideEffect() { | 34 static testSideEffect() { |
| 35 int result = 0; | 35 int result = 0; |
| 36 int index() { | 36 int index() { |
| 37 result++; | 37 result++; |
| 38 return 0; | 38 return 0; |
| 39 } | 39 } |
| 40 try { | 40 try { |
| 41 var a = new List<int>(1) as List<int>; | 41 var a = new List<int>.fixedLength(1) as List<int>; |
| 42 a[0] = 0; | 42 a[0] = 0; |
| 43 a[index()]++; // Type check succeeds, but does not create side effects. | 43 a[index()]++; // Type check succeeds, but does not create side effects. |
| 44 Expect.equals(1, a[0]); | 44 Expect.equals(1, a[0]); |
| 45 } on TypeError catch (error) { | 45 } on TypeError catch (error) { |
| 46 result = 100; | 46 result = 100; |
| 47 } | 47 } |
| 48 return result; | 48 return result; |
| 49 } | 49 } |
| 50 | 50 |
| 51 static testArgument() { | 51 static testArgument() { |
| (...skipping 101 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 |