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

Side by Side Diff: tests/language/static_field_test.dart

Issue 10541140: re-writes some static field negative tests for use with analyzer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: # Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/static_field2a_run_negative_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Dart test program for testing setting/getting/initializing static fields. 4 // Dart test program for testing setting/getting/initializing static fields.
5 5
6 class First { 6 class First {
7 First() {} 7 First() {}
8 static var a; 8 static var a;
9 static var b; 9 static var b;
10 static final int c = 1; 10 static final int c = 1;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 First.b = First.a = 15; 55 First.b = First.a = 15;
56 Expect.equals(15, First.a); 56 Expect.equals(15, First.a);
57 Expect.equals(15, First.b); 57 Expect.equals(15, First.b);
58 Expect.equals(35, First.setValues()); 58 Expect.equals(35, First.setValues());
59 Expect.equals(24, First.a); 59 Expect.equals(24, First.a);
60 Expect.equals(10, First.b); 60 Expect.equals(10, First.b);
61 } 61 }
62 } 62 }
63 63
64 64
65 class StaticField1RunNegativeTest {
66 static /// 01: static type warning, runtime error
67 var x;
68 static testMain() {
69 var foo = new StaticField1RunNegativeTest();
ahe 2012/06/13 14:27:24 Here I would say: print(x); to make sure x is "c
zundel 2012/06/13 15:15:43 Done.
70 var x = foo.x;
ahe 2012/06/13 14:27:24 I would put the /// comment on this line. Also, I
zundel 2012/06/13 15:15:43 Got rid of the shadowing, but left the other in pl
71 }
72 }
73
74 class StaticField1aRunNegativeTest {
75 static /// 02: static type warning, runtime error
76 void m() {}
77
78 static testMain() {
79 var foo = new StaticField1aRunNegativeTest();
80 var m = foo.m;
ahe 2012/06/13 14:27:24 Ditto. For all three remarks above.
81 }
82 }
83
84 class StaticField2RunNegativeTest {
85 static /// 03: static type warning, runtime error
86 var x;
87
88 static testMain() {
89 var foo = new StaticField2RunNegativeTest();
90 foo.x = 1;
ahe 2012/06/13 14:27:24 Ditto (all three).
91 }
92 }
93
94 class StaticField2aRunNegativeTest {
95 static void m() {} /// 04: static type warning, runtime error
96
97 static testMain() {
98 var foo = new StaticField2aRunNegativeTest();
99 foo.m = 1; /// 04:continued
ahe 2012/06/13 14:27:24 Ditto (all three).
zundel 2012/06/13 15:15:43 I'm not sure the original author of this test real
100 }
101 }
102
65 main() { 103 main() {
66 StaticFieldTest.testMain(); 104 StaticFieldTest.testMain();
67 InitializerTest.testStaticFieldInitialization(); 105 InitializerTest.testStaticFieldInitialization();
106 StaticField1RunNegativeTest.testMain();
107 StaticField1aRunNegativeTest.testMain();
108 StaticField2RunNegativeTest.testMain();
109 StaticField2aRunNegativeTest.testMain();
68 } 110 }
OLDNEW
« no previous file with comments | « tests/language/static_field2a_run_negative_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698