Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'multiline_newline_cr.dart' as cr; | 6 import 'multiline_newline_cr.dart' as cr; |
| 7 import 'multiline_newline_crlf.dart' as crlf; | 7 import 'multiline_newline_crlf.dart' as crlf; |
| 8 import 'multiline_newline_lf.dart' as lf; | 8 import 'multiline_newline_lf.dart' as lf; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 Expect.equals(4, cr.constantMultilineString.length); | 11 Expect.equals(4, cr.constantMultilineString.length); |
| 12 Expect.equals(4, crlf.constantMultilineString.length); | 12 Expect.equals(4, crlf.constantMultilineString.length); |
| 13 Expect.equals(4, lf.constantMultilineString.length); | 13 Expect.equals(4, lf.constantMultilineString.length); |
| 14 | |
| 15 Expect.equals(6, cr.constantRawMultilineString.length); | |
| 16 Expect.equals(6, crlf.constantRawMultilineString.length); | |
| 17 Expect.equals(6, lf.constantRawMultilineString.length); | |
| 18 | |
| 14 Expect.equals(cr.constantMultilineString, crlf.constantMultilineString); | 19 Expect.equals(cr.constantMultilineString, crlf.constantMultilineString); |
| 15 Expect.equals(crlf.constantMultilineString, lf.constantMultilineString); | 20 Expect.equals(crlf.constantMultilineString, lf.constantMultilineString); |
| 16 Expect.equals(lf.constantMultilineString, cr.constantMultilineString); | 21 Expect.equals(lf.constantMultilineString, cr.constantMultilineString); |
| 17 | 22 |
| 23 Expect.equals(cr.constantRawMultilineString, crlf.constantRawMultilineString); | |
| 24 Expect.equals(crlf.constantRawMultilineString, lf.constantRawMultilineString); | |
| 25 Expect.equals(lf.constantRawMultilineString, cr.constantRawMultilineString); | |
| 26 | |
| 18 Expect.equals(4, cr.nonConstantMultilineString.length); | 27 Expect.equals(4, cr.nonConstantMultilineString.length); |
| 19 Expect.equals(4, crlf.nonConstantMultilineString.length); | 28 Expect.equals(4, crlf.nonConstantMultilineString.length); |
| 20 Expect.equals(4, lf.nonConstantMultilineString.length); | 29 Expect.equals(4, lf.nonConstantMultilineString.length); |
| 30 | |
| 31 Expect.equals(6, cr.nonConstantRawMultilineString.length); | |
| 32 Expect.equals(6, crlf.nonConstantRawMultilineString.length); | |
| 33 Expect.equals(6, lf.nonConstantRawMultilineString.length); | |
| 34 | |
| 21 Expect.equals(cr.nonConstantMultilineString, crlf.nonConstantMultilineString); | 35 Expect.equals(cr.nonConstantMultilineString, crlf.nonConstantMultilineString); |
| 22 Expect.equals(crlf.nonConstantMultilineString, lf.nonConstantMultilineString); | 36 Expect.equals(crlf.nonConstantMultilineString, lf.nonConstantMultilineString); |
| 23 Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); | 37 Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); |
| 24 | 38 |
| 39 Expect.equals( | |
| 40 cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); | |
| 41 Expect.equals( | |
| 42 crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); | |
| 43 Expect.equals( | |
| 44 lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); | |
| 45 | |
| 25 const c1 = | 46 const c1 = |
| 26 cr.constantMultilineString == crlf.constantMultilineString ? true : null; | 47 cr.constantMultilineString == crlf.constantMultilineString ? true : null; |
| 27 const c2 = | 48 const c2 = |
| 28 crlf.constantMultilineString == lf.constantMultilineString ? true : null; | 49 crlf.constantMultilineString == lf.constantMultilineString ? true : null; |
| 29 const c3 = | 50 const c3 = |
| 30 lf.constantMultilineString == cr.constantMultilineString ? true : null; | 51 lf.constantMultilineString == cr.constantMultilineString ? true : null; |
| 31 Expect.isTrue(c1); | 52 Expect.isTrue(c1); |
| 32 Expect.isTrue(c2); | 53 Expect.isTrue(c2); |
| 33 Expect.isTrue(c3); | 54 Expect.isTrue(c3); |
| 34 | 55 |
| 56 const c1r = cr.constantRawMultilineString == crlf.constantRawMultilineString | |
| 57 ? true | |
| 58 : null; | |
|
Lasse Reichstein Nielsen
2017/04/28 06:34:28
Why the `? true : null` followed by `Expect.isTrue
Johnni Winther
2017/04/28 07:12:00
For analyzer testing. See lines 110-116
| |
| 59 const c2r = crlf.constantRawMultilineString == lf.constantRawMultilineString | |
| 60 ? true | |
| 61 : null; | |
| 62 const c3r = lf.constantRawMultilineString == cr.constantRawMultilineString | |
| 63 ? true | |
| 64 : null; | |
| 65 Expect.isTrue(c1r); | |
| 66 Expect.isTrue(c2r); | |
| 67 Expect.isTrue(c3r); | |
| 68 | |
| 35 const c4 = c1 ? 1 : 2; // //# 01: ok | 69 const c4 = c1 ? 1 : 2; // //# 01: ok |
| 36 Expect.equals(1, c4); // //# 01: continued | 70 Expect.equals(1, c4); // //# 01: continued |
| 37 | 71 |
| 38 const c5 = c2 ? 2 : 3; // //# 02: ok | 72 const c5 = c2 ? 2 : 3; // //# 02: ok |
| 39 Expect.equals(2, c5); // //# 02: continued | 73 Expect.equals(2, c5); // //# 02: continued |
| 40 | 74 |
| 41 const c6 = c3 ? 3 : 4; // //# 03: ok | 75 const c6 = c3 ? 3 : 4; // //# 03: ok |
| 42 Expect.equals(3, c6); // //# 03: continued | 76 Expect.equals(3, c6); // //# 03: continued |
| 43 | 77 |
| 78 const c4r = c1r ? 1 : 2; // //# 01r: ok | |
| 79 Expect.equals(1, c4r); // //# 01r: continued | |
|
Lasse Reichstein Nielsen
2017/04/28 06:34:28
Comment indentation off by one :)
More below.
ahe
2017/04/28 07:39:00
Acknowledged.
ahe
2017/05/08 08:36:17
Done.
| |
| 80 | |
| 81 const c5r = c2r ? 2 : 3; // //# 02r: ok | |
| 82 Expect.equals(2, c5r); // //# 02r: continued | |
| 83 | |
| 84 const c6r = c3r ? 3 : 4; // //# 03r: ok | |
| 85 Expect.equals(3, c6r); // //# 03r: continued | |
| 86 | |
| 44 const c7 = | 87 const c7 = |
| 45 cr.constantMultilineString != crlf.constantMultilineString ? true : null; | 88 cr.constantMultilineString != crlf.constantMultilineString ? true : null; |
| 46 const c8 = | 89 const c8 = |
| 47 crlf.constantMultilineString != lf.constantMultilineString ? true : null; | 90 crlf.constantMultilineString != lf.constantMultilineString ? true : null; |
| 48 const c9 = | 91 const c9 = |
| 49 lf.constantMultilineString != cr.constantMultilineString ? true : null; | 92 lf.constantMultilineString != cr.constantMultilineString ? true : null; |
| 50 Expect.isNull(c7); | 93 Expect.isNull(c7); |
| 51 Expect.isNull(c8); | 94 Expect.isNull(c8); |
| 52 Expect.isNull(c9); | 95 Expect.isNull(c9); |
| 53 | 96 |
| 97 const c7r = cr.constantRawMultilineString != crlf.constantRawMultilineString | |
| 98 ? true | |
| 99 : null; | |
| 100 const c8r = crlf.constantRawMultilineString != lf.constantRawMultilineString | |
| 101 ? true | |
| 102 : null; | |
| 103 const c9r = lf.constantRawMultilineString != cr.constantRawMultilineString | |
| 104 ? true | |
| 105 : null; | |
| 106 Expect.isNull(c7r); | |
| 107 Expect.isNull(c8r); | |
| 108 Expect.isNull(c9r); | |
| 109 | |
| 54 const c10 = c7 ? 1 : 2; // //# 04: compile-time error | 110 const c10 = c7 ? 1 : 2; // //# 04: compile-time error |
|
Lasse Reichstein Nielsen
2017/04/28 06:34:28
What is this testing? That `null` cannot be used a
Johnni Winther
2017/04/28 07:12:01
This is to validate the analyzer implementation. I
ahe
2017/04/28 07:39:00
Not only does this validate the analyzer implement
Lasse Reichstein Nielsen
2017/04/28 08:57:36
So the null is there to force a compile-time error
Johnni Winther
2017/04/28 09:19:43
We should probably add a comment about the intent
ahe
2017/05/08 08:36:17
Done.
| |
| 55 const c11 = c8 ? 2 : 3; // //# 05: compile-time error | 111 const c11 = c8 ? 2 : 3; // //# 05: compile-time error |
| 56 const c12 = c9 ? 3 : 4; // //# 06: compile-time error | 112 const c12 = c9 ? 3 : 4; // //# 06: compile-time error |
| 113 | |
| 114 const c10r = c7r ? 1 : 2; // //# 04r: compile-time error | |
| 115 const c11r = c8r ? 2 : 3; // //# 05r: compile-time error | |
| 116 const c12r = c9r ? 3 : 4; // //# 06r: compile-time error | |
| 57 } | 117 } |
| OLD | NEW |