Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: tests/language_strong/final_syntax_test.dart

Issue 2765693002: Update all tests (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 main() { 7 main() {
8 final f0 = 42; 8 final f0 = 42;
9 final f1; /// 01: compile-time error 9 final f1; //# 01: compile-time error
10 final int f2 = 87; 10 final int f2 = 87;
11 final int f3; /// 02: compile-time error 11 final int f3; //# 02: compile-time error
12 Expect.equals(42, f0); 12 Expect.equals(42, f0);
13 Expect.equals(87, f2); 13 Expect.equals(87, f2);
14 14
15 Expect.equals(42, F0); 15 Expect.equals(42, F0);
16 Expect.equals(null, F1); /// 03: compile-time error 16 Expect.equals(null, F1); //# 03: compile-time error
17 Expect.equals(87, F2); 17 Expect.equals(87, F2);
18 Expect.equals(null, F3); /// 04: compile-time error 18 Expect.equals(null, F3); //# 04: compile-time error
19 19
20 Expect.isTrue(P0 is Point); 20 Expect.isTrue(P0 is Point);
21 Expect.isTrue(P1 is int); 21 Expect.isTrue(P1 is int);
22 Expect.isTrue(P2 is Point); 22 Expect.isTrue(P2 is Point);
23 Expect.isTrue(P3 is int); 23 Expect.isTrue(P3 is int);
24 24
25 Expect.isTrue(A0 is int); 25 Expect.isTrue(A0 is int);
26 Expect.isTrue(A1 is int); 26 Expect.isTrue(A1 is int);
27 Expect.isTrue(A2 is int); /// 08: runtime error 27 Expect.isTrue(A2 is int); //# 08: runtime error
28 Expect.isTrue(A3 is int); /// 08: continued 28 Expect.isTrue(A3 is int); //# 08: continued
29 29
30 Expect.isTrue(C0.X is C1); 30 Expect.isTrue(C0.X is C1);
31 Expect.isTrue(C0.X.x is C1); /// 09: compile-time error 31 Expect.isTrue(C0.X.x is C1); //# 09: compile-time error
32 32
33 Expect.equals("Hello 42", B2); 33 Expect.equals("Hello 42", B2);
34 Expect.equals("42Hello", B3); /// 10: runtime error 34 Expect.equals("42Hello", B3); //# 10: runtime error
35 } 35 }
36 36
37 final F0 = 42; 37 final F0 = 42;
38 final F1; /// 03: continued 38 final F1; //# 03: continued
39 final int F2 = 87; 39 final int F2 = 87;
40 final int F3; /// 04: continued 40 final int F3; //# 04: continued
41 41
42 class Point { 42 class Point {
43 final x, y; 43 final x, y;
44 const Point(this.x, this.y); 44 const Point(this.x, this.y);
45 operator +(int other) => x; 45 operator +(int other) => x;
46 } 46 }
47 47
48 // Check that compile time expressions can include invocations of 48 // Check that compile time expressions can include invocations of
49 // user-defined final constructors. 49 // user-defined final constructors.
50 final P0 = const Point(0, 0); 50 final P0 = const Point(0, 0);
51 final P1 = const Point(0, 0) + 1; 51 final P1 = const Point(0, 0) + 1;
52 final P2 = new Point(0, 0); 52 final P2 = new Point(0, 0);
53 final P3 = new Point(0, 0) + 1; 53 final P3 = new Point(0, 0) + 1;
54 54
55 // Check that we cannot have cyclic references in compile time 55 // Check that we cannot have cyclic references in compile time
56 // expressions. 56 // expressions.
57 final A0 = 42; 57 final A0 = 42;
58 final A1 = A0 + 1; 58 final A1 = A0 + 1;
59 final A2 = A3 + 1; /// 08: continued 59 final A2 = A3 + 1; //# 08: continued
60 final A3 = A2 + 1; /// 08: continued 60 final A3 = A2 + 1; //# 08: continued
61 61
62 class C0 { 62 class C0 {
63 static final X = const C1(); 63 static final X = const C1();
64 } 64 }
65 65
66 class C1 { 66 class C1 {
67 const C1() 67 const C1()
68 : x = C0.X /// 09: continued 68 : x = C0.X //# 09: continued
69 ; 69 ;
70 final x = null; 70 final x = null;
71 } 71 }
72 72
73 // Check that sub-expressions of binary + are numeric. 73 // Check that sub-expressions of binary + are numeric.
74 final B0 = 42; 74 final B0 = 42;
75 final B1 = "Hello"; 75 final B1 = "Hello";
76 final B2 = "$B1 $B0"; 76 final B2 = "$B1 $B0";
77 final B3 = B0 + B1; /// 10: continued 77 final B3 = B0 + B1; //# 10: continued
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698