Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: tests/corelib/src/IsOperatorBasicTypesTest.dart

Issue 10244009: test rename overhaul: step 7 - corelib tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program for the "is" type test operator.
5
6 check(args) {
7 var list = args[0];
8 var string = args[1];
9 var nullObject = args[2];
10
11 Expect.isTrue(list is Object);
12 Expect.isTrue(list is List);
13 Expect.isTrue(list is Collection);
14 Expect.isTrue(list is Iterable);
15 Expect.isFalse(list is Comparable);
16 Expect.isFalse(list is Hashable);
17 Expect.isFalse(list is Pattern);
18 Expect.isFalse(list is String);
19
20 Expect.isFalse(list is !List);
21 Expect.isFalse(list is !Collection);
22 Expect.isFalse(list is !Iterable);
23 Expect.isTrue(list is !Comparable);
24 Expect.isTrue(list is !Hashable);
25 Expect.isTrue(list is !Pattern);
26 Expect.isTrue(list is !String);
27
28 Expect.isTrue(string is Object);
29 Expect.isFalse(string is List);
30 Expect.isFalse(string is Collection);
31 Expect.isFalse(string is Iterable);
32 Expect.isTrue(string is Comparable);
33 Expect.isTrue(string is Hashable);
34 Expect.isTrue(string is Pattern);
35 Expect.isTrue(string is String);
36
37 Expect.isTrue(string is !List);
38 Expect.isTrue(string is !Collection);
39 Expect.isTrue(string is !Iterable);
40 Expect.isFalse(string is !Comparable);
41 Expect.isFalse(string is !Hashable);
42 Expect.isFalse(string is !Pattern);
43 Expect.isFalse(string is !String);
44
45 Expect.isTrue(nullObject is Object);
46 Expect.isFalse(nullObject is List);
47 Expect.isFalse(nullObject is Collection);
48 Expect.isFalse(nullObject is Iterable);
49 Expect.isFalse(nullObject is Comparable);
50 Expect.isFalse(nullObject is Hashable);
51 Expect.isFalse(nullObject is Pattern);
52 Expect.isFalse(nullObject is String);
53
54 Expect.isTrue(nullObject is !List);
55 Expect.isTrue(nullObject is !Collection);
56 Expect.isTrue(nullObject is !Iterable);
57 Expect.isTrue(nullObject is !Comparable);
58 Expect.isTrue(nullObject is !Hashable);
59 Expect.isTrue(nullObject is !Pattern);
60 Expect.isTrue(nullObject is !String);
61 }
62
63 main() {
64 // Try to make it hard for an optimizing compiler to inline the
65 // tests.
66 check([[], 'string', null]);
67
68 // Try to make it even harder.
69 var string = new String.fromCharCodes([new Date.now().year % 100 + 1]);
70 check([string.charCodes(), string, null]);
71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698