OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 const x = "foo"; | 7 const x = "foo"; |
8 const y = "foo"; | 8 const y = "foo"; |
9 const g1 = x + "bar"; | 9 const g1 = x |
| 10 + "bar" |
| 11 ; |
10 const g2 = x | 12 const g2 = x |
11 + null // //# 01: compile-time error | 13 + null // //# 01: compile-time error |
12 ; | 14 ; |
13 const g3 = x | 15 const g3 = x |
14 + 499 // //# 02: compile-time error | 16 + 499 // //# 02: compile-time error |
15 ; | 17 ; |
16 const g4 = x | 18 const g4 = x |
17 + 3.3 // //# 03: compile-time error | 19 + 3.3 // //# 03: compile-time error |
18 ; | 20 ; |
19 const g5 = x | 21 const g5 = x |
20 + true // //# 04: compile-time error | 22 + true // //# 04: compile-time error |
21 ; | 23 ; |
22 const g6 = x | 24 const g6 = x |
23 + false // //# 05: compile-time error | 25 + false // //# 05: compile-time error |
24 ; | 26 ; |
25 const g7 = "foo" | 27 const g7 = "foo" |
26 + x[0] // //# 06: compile-time error | 28 + x[0] // //# 06: compile-time error |
27 ; | 29 ; |
28 const g8 = 1 + x.length; | 30 const g8 = 1 |
| 31 + x.length |
| 32 ; |
29 const g9 = x == y; | 33 const g9 = x == y; |
30 | 34 |
31 use(x) => x; | 35 use(x) => x; |
32 | 36 |
33 main() { | 37 main() { |
34 Expect.equals("foobar", g1); | 38 Expect.equals("foobar", g1); |
35 Expect.isTrue(g9); | 39 Expect.isTrue(g9); |
36 use(g1); | 40 use(g1); |
37 use(g2); | 41 use(g2); |
38 use(g3); | 42 use(g3); |
39 use(g4); | 43 use(g4); |
40 use(g5); | 44 use(g5); |
41 use(g6); | 45 use(g6); |
42 use(g7); | 46 use(g7); |
43 use(g8); | 47 use(g8); |
44 } | 48 } |
OLD | NEW |