OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 201, the Dart project authors. Please see the AUTHORS file | |
eernst
2017/07/03 16:36:37
Typo: `2017`
Lasse Reichstein Nielsen
2017/07/10 10:57:02
Done.
| |
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 // VMOptions=--assert_initializer | |
5 // | |
6 // Dart test program testing assert statements. | |
7 | |
8 import "package:expect/expect.dart"; | |
9 | |
10 class C { | |
11 final int x; | |
12 // Const constructors. | |
13 const C.cc01(this.x, y) : assert(x < y); | |
14 const C.cc02(x, y) : x = x, assert(x < y); | |
15 const C.cc03(x, y) : assert(x < y), x = x; | |
16 const C.cc04(this.x, y) : super(), assert(x < y); | |
17 const C.cc05(this.x, y) : assert(x < y), super(); | |
18 const C.cc06(x, y) : x = x, super(), assert(x < y); | |
19 const C.cc07(x, y) : assert(x < y), super(), x = x; | |
20 const C.cc08(x, y) : assert(x < y), super(), x = x, assert(y > x); | |
21 const C.cc09(this.x, y) : assert(x < y, "$x < $y"); | |
22 const C.cc10(this.x, y) : assert(x < y,); | |
23 const C.cc11(this.x, y) : assert(x < y, "$x < $y",); | |
24 } | |
25 | |
26 | |
27 main() { | |
28 // Failing assertions in const invociations are compile-time errors. | |
29 const C.cc01(2, 1); //# cc01: compile-time error | |
30 const C.cc02(2, 1); //# cc02: compile-time error | |
31 const C.cc03(2, 1); //# cc03: compile-time error | |
32 const C.cc04(2, 1); //# cc04: compile-time error | |
33 const C.cc05(2, 1); //# cc05: compile-time error | |
34 const C.cc06(2, 1); //# cc06: compile-time error | |
35 const C.cc07(2, 1); //# cc07: compile-time error | |
36 const C.cc08(2, 1); //# cc08: compile-time error | |
37 const C.cc09(2, 1); //# cc09: compile-time error | |
38 const C.cc10(2, 1); //# cc10: compile-time error | |
39 const C.cc11(2, 1); //# cc11: compile-time error | |
40 } | |
OLD | NEW |