OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 201, 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 // 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) |
| 14 : assert(x < y) //# cc01: compile-time error |
| 15 ; |
| 16 const C.cc02(x, y) : x = x, |
| 17 assert(x < y) //# cc02: compile-time error |
| 18 ; |
| 19 const C.cc03(x, y) : |
| 20 assert(x < y), //# cc03: compile-time error |
| 21 x = x; |
| 22 const C.cc04(this.x, y) : super() |
| 23 , assert(x < y) //# cc04: compile-time error |
| 24 ; |
| 25 const C.cc05(this.x, y) : |
| 26 assert(x < y), //# cc05: compile-time error |
| 27 super(); |
| 28 const C.cc06(x, y) : x = x, super() |
| 29 , assert(x < y) //# cc06: compile-time error |
| 30 ; |
| 31 const C.cc07(x, y) : |
| 32 assert(x < y), //# cc07: compile-time error |
| 33 super(), x = x; |
| 34 const C.cc08(x, y) : |
| 35 assert(x < y), //# cc08: compile-time error |
| 36 super(), x = x |
| 37 , assert(y > x) //# cc08: continued |
| 38 ; |
| 39 const C.cc09(this.x, y) |
| 40 : assert(x < y, "$x < $y") //# cc09: compile-time error |
| 41 ; |
| 42 const C.cc10(this.x, y) |
| 43 : assert(x < y,) //# cc10: compile-time error |
| 44 ; |
| 45 const C.cc11(this.x, y) |
| 46 : assert(x < y, "$x < $y",) //# cc11: compile-time error |
| 47 ; |
| 48 } |
| 49 |
| 50 |
| 51 main() { |
| 52 // Failing assertions in const invociations are compile-time errors. |
| 53 const C.cc01(2, 1); //# cc01: compile-time error |
| 54 const C.cc02(2, 1); //# cc02: compile-time error |
| 55 const C.cc03(2, 1); //# cc03: compile-time error |
| 56 const C.cc04(2, 1); //# cc04: compile-time error |
| 57 const C.cc05(2, 1); //# cc05: compile-time error |
| 58 const C.cc06(2, 1); //# cc06: compile-time error |
| 59 const C.cc07(2, 1); //# cc07: compile-time error |
| 60 const C.cc08(2, 1); //# cc08: compile-time error |
| 61 const C.cc09(2, 1); //# cc09: compile-time error |
| 62 const C.cc10(2, 1); //# cc10: compile-time error |
| 63 const C.cc11(2, 1); //# cc11: compile-time error |
| 64 } |
OLD | NEW |