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 // Dart test program for the "is" type test operator. | 4 // Dart test program for the "is" type test operator. |
5 | 5 |
6 import "package:expect/expect.dart"; | |
7 | |
8 check(args) { | 6 check(args) { |
9 var list = args[0]; | 7 var list = args[0]; |
10 var string = args[1]; | 8 var string = args[1]; |
11 var nullObject = args[2]; | 9 var nullObject = args[2]; |
12 | 10 |
13 Expect.isTrue(list is Object); | 11 Expect.isTrue(list is Object); |
14 Expect.isTrue(list is List); | 12 Expect.isTrue(list is List); |
15 Expect.isTrue(list is Collection); | 13 Expect.isTrue(list is Collection); |
16 Expect.isTrue(list is Iterable); | 14 Expect.isTrue(list is Iterable); |
17 Expect.isFalse(list is Comparable); | 15 Expect.isFalse(list is Comparable); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 56 |
59 main() { | 57 main() { |
60 // Try to make it hard for an optimizing compiler to inline the | 58 // Try to make it hard for an optimizing compiler to inline the |
61 // tests. | 59 // tests. |
62 check([[], 'string', null]); | 60 check([[], 'string', null]); |
63 | 61 |
64 // Try to make it even harder. | 62 // Try to make it even harder. |
65 var string = new String.fromCharCodes([new DateTime.now().year % 100 + 1]); | 63 var string = new String.fromCharCodes([new DateTime.now().year % 100 + 1]); |
66 check([string.codeUnits, string, null]); | 64 check([string.codeUnits, string, null]); |
67 } | 65 } |
OLD | NEW |