| 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 | 4 |
| 5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 class C<T, U, V> {} | 7 class C<T, U, V> {} |
| 8 | 8 |
| 9 class D {} | 9 class D {} |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Test that class literals return instances of Type. | 35 // Test that class literals return instances of Type. |
| 36 Expect.isTrue((D).runtimeType is Type); | 36 Expect.isTrue((D).runtimeType is Type); |
| 37 Expect.isTrue((dynamic).runtimeType is Type); | 37 Expect.isTrue((dynamic).runtimeType is Type); |
| 38 | 38 |
| 39 // Test that types from runtimeType and literals agree. | 39 // Test that types from runtimeType and literals agree. |
| 40 Expect.equals(int, 1.runtimeType); | 40 Expect.equals(int, 1.runtimeType); |
| 41 Expect.equals(String, 'hest'.runtimeType); | 41 Expect.equals(String, 'hest'.runtimeType); |
| 42 Expect.equals(double, (0.5).runtimeType); | 42 Expect.equals(double, (0.5).runtimeType); |
| 43 Expect.equals(bool, true.runtimeType); | 43 Expect.equals(bool, true.runtimeType); |
| 44 Expect.equals(C, new C().runtimeType); // /// 01: ok | 44 Expect.equals(C, new C().runtimeType); // //# 01: ok |
| 45 Expect.equals(D, new D().runtimeType); // /// 02: ok | 45 Expect.equals(D, new D().runtimeType); // //# 02: ok |
| 46 | 46 |
| 47 // runtimeType on type is idempotent. | 47 // runtimeType on type is idempotent. |
| 48 Expect.equals((D).runtimeType, (D).runtimeType.runtimeType); | 48 Expect.equals((D).runtimeType, (D).runtimeType.runtimeType); |
| 49 | 49 |
| 50 // Test that operator calls on class literals go to Type. | 50 // Test that operator calls on class literals go to Type. |
| 51 Expect.throws(() => C = 1, (e) => e is NoSuchMethodError); /// 03: static type
warning | 51 Expect.throws(() => C = 1, (e) => e is NoSuchMethodError); //# 03: static type
warning |
| 52 Expect.throws(() => C++, (e) => e is NoSuchMethodError); /// 04: static type w
arning | 52 Expect.throws(() => C++, (e) => e is NoSuchMethodError); //# 04: static type w
arning |
| 53 Expect.throws(() => C + 1, (e) => e is NoSuchMethodError); /// 05: static type
warning | 53 Expect.throws(() => C + 1, (e) => e is NoSuchMethodError); //# 05: static type
warning |
| 54 Expect.throws(() => C[2], (e) => e is NoSuchMethodError); /// 06: static type
warning | 54 Expect.throws(() => C[2], (e) => e is NoSuchMethodError); //# 06: static type
warning |
| 55 Expect.throws(() => C[2] = 'hest', (e) => e is NoSuchMethodError); /// 07: sta
tic type warning | 55 Expect.throws(() => C[2] = 'hest', (e) => e is NoSuchMethodError); //# 07: sta
tic type warning |
| 56 Expect.throws(() => dynamic = 1, (e) => e is NoSuchMethodError); /// 08: stati
c type warning | 56 Expect.throws(() => dynamic = 1, (e) => e is NoSuchMethodError); //# 08: stati
c type warning |
| 57 Expect.throws(() => dynamic++, (e) => e is NoSuchMethodError); /// 09: static
type warning | 57 Expect.throws(() => dynamic++, (e) => e is NoSuchMethodError); //# 09: static
type warning |
| 58 Expect.throws(() => dynamic + 1, (e) => e is NoSuchMethodError); /// 10: stati
c type warning | 58 Expect.throws(() => dynamic + 1, (e) => e is NoSuchMethodError); //# 10: stati
c type warning |
| 59 Expect.throws(() => dynamic[2], (e) => e is NoSuchMethodError); /// 11: static
type warning | 59 Expect.throws(() => dynamic[2], (e) => e is NoSuchMethodError); //# 11: static
type warning |
| 60 Expect.throws(() => dynamic[2] = 'hest', (e) => e is NoSuchMethodError); /// 1
2: static type warning | 60 Expect.throws(() => dynamic[2] = 'hest', (e) => e is NoSuchMethodError); //# 1
2: static type warning |
| 61 | 61 |
| 62 Expect.equals((dynamic).toString(), 'dynamic'); | 62 Expect.equals((dynamic).toString(), 'dynamic'); |
| 63 } | 63 } |
| OLD | NEW |