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