OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 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 | 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 void or1() { | 7 void or1() { |
8 var b = true; | 8 var b = true; |
9 b = b || b; | 9 b = b || b; |
10 Expect.equals(true, b); | 10 Expect.equals(true, b); |
(...skipping 11 matching lines...) Expand all Loading... |
22 Expect.equals(true, b); | 22 Expect.equals(true, b); |
23 } | 23 } |
24 | 24 |
25 void or4() { | 25 void or4() { |
26 var b = true; | 26 var b = true; |
27 b = b || true; | 27 b = b || true; |
28 Expect.equals(true, b); | 28 Expect.equals(true, b); |
29 } | 29 } |
30 | 30 |
31 void or5() { | 31 void or5() { |
32 if (true || false) { | 32 if (true || false) {} else { |
33 } else { | |
34 Expect.fail('unreachable'); | 33 Expect.fail('unreachable'); |
35 } | 34 } |
36 } | 35 } |
37 | 36 |
38 void or6() { | 37 void or6() { |
39 var b = true; | 38 var b = true; |
40 if (true || true) b = false; | 39 if (true || true) b = false; |
41 Expect.equals(false, b); | 40 Expect.equals(false, b); |
42 } | 41 } |
43 | 42 |
44 void or7() { | 43 void or7() { |
45 var b = false; | 44 var b = false; |
46 if (true || false) { | 45 if (true || false) { |
47 b = true; | 46 b = true; |
48 } else { | 47 } else { |
49 b = false; | 48 b = false; |
50 } | 49 } |
51 Expect.equals(true, b); | 50 Expect.equals(true, b); |
52 } | 51 } |
53 | 52 |
54 void main() { | 53 void main() { |
55 or1(); | 54 or1(); |
56 or2(); | 55 or2(); |
57 or3(); | 56 or3(); |
58 or4(); | 57 or4(); |
59 or5(); | 58 or5(); |
60 or6(); | 59 or6(); |
61 or7(); | 60 or7(); |
62 } | 61 } |
OLD | NEW |