OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011, 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 interface I { } | |
7 | |
8 interface AI extends I { } | |
9 | |
10 class A implements AI { | |
11 const A(); | |
12 } | |
13 | |
14 class B implements I { | |
15 const B(); | |
16 } | |
17 | |
18 class C extends A { | |
19 const C() : super(); | |
20 } | |
21 | |
22 class IsOperatorTest { | |
23 static testMain() { | |
24 var a = new A(); | |
25 var b = new B(); | |
26 var c = new C(); | |
27 var n = null; | |
28 Expect.equals(true, a is A); | |
29 Expect.equals(false, a is !A); | |
30 Expect.equals(true, b is B); | |
31 Expect.equals(false, b is !B); | |
32 Expect.equals(true, c is C); | |
33 Expect.equals(false, c is !C); | |
34 Expect.equals(true, c is A); | |
35 Expect.equals(false, c is !A); | |
36 | |
37 Expect.equals(true, a is AI); | |
38 Expect.equals(false, a is !AI); | |
39 Expect.equals(true, a is I); | |
40 Expect.equals(false, a is !I); | |
41 Expect.equals(false, b is AI); | |
42 Expect.equals(true, b is !AI); | |
43 Expect.equals(true, b is I); | |
44 Expect.equals(false, b is !I); | |
45 Expect.equals(true, c is AI); | |
46 Expect.equals(false, c is !AI); | |
47 Expect.equals(true, c is I); | |
48 Expect.equals(false, c is !I); | |
49 Expect.equals(false, n is AI); | |
50 Expect.equals(true, n is !AI); | |
51 Expect.equals(false, n is I); | |
52 Expect.equals(true, n is !I); | |
53 | |
54 Expect.equals(false, a is B); | |
55 Expect.equals(true, a is !B); | |
56 Expect.equals(false, a is C); | |
57 Expect.equals(true, a is !C); | |
58 Expect.equals(false, b is A); | |
59 Expect.equals(true, b is !A); | |
60 Expect.equals(false, b is C); | |
61 Expect.equals(true, b is !C); | |
62 Expect.equals(false, c is B); | |
63 Expect.equals(true, c is !B); | |
64 Expect.equals(false, n is A); | |
65 Expect.equals(true, n is !A); | |
66 | |
67 Expect.equals(false, null is A); | |
68 Expect.equals(false, null is B); | |
69 Expect.equals(false, null is C); | |
70 Expect.equals(false, null is AI); | |
71 Expect.equals(false, null is I); | |
72 | |
73 Expect.equals(true, null is !A); | |
74 Expect.equals(true, null is !B); | |
75 Expect.equals(true, null is !C); | |
76 Expect.equals(true, null is !AI); | |
77 Expect.equals(true, null is !I); | |
78 } | |
79 } | |
80 | |
81 main() { | |
82 IsOperatorTest.testMain(); | |
83 } | |
OLD | NEW |