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