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

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

Issue 10829416: Update language tests to new getter syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 | « dart/tests/language/resolution_test.dart ('k') | dart/tests/language/setter1_test.dart » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 of fields when 4 // Dart test program for testing setting/getting of fields when
5 // only getter/setter methods are specified. 5 // only getter/setter methods are specified.
6 6
7 class First { 7 class First {
8 First(int val) : a_ = val { } 8 First(int val) : a_ = val { }
9 int a_; 9 int a_;
10 } 10 }
11 11
12 class Second extends First { 12 class Second extends First {
13 static int c; 13 static int c;
14 14
15 Second(int val) : super(val) { } 15 Second(int val) : super(val) { }
16 16
17 static void testStaticMethod() { 17 static void testStaticMethod() {
18 int i; 18 int i;
19 Second.static_a = 20; 19 Second.static_a = 20;
20 i = Second.c; 20 i = Second.c;
21 } 21 }
22 22
23 void set instance_a(int value) { 23 void set instance_a(int value) {
24 a_ = a_ + value; 24 a_ = a_ + value;
25 } 25 }
26 int get instance_a() { 26 int get instance_a {
27 return a_; 27 return a_;
28 } 28 }
29 29
30 static void set static_a(int value) { 30 static void set static_a(int value) {
31 Second.c = value; 31 Second.c = value;
32 } 32 }
33 33
34 static int get static_d() { 34 static int get static_d {
35 return Second.c; 35 return Second.c;
36 } 36 }
37 } 37 }
38 38
39 class Setter0Test { 39 class Setter0Test {
40 static testMain() { 40 static testMain() {
41 Second obj = new Second(10); 41 Second obj = new Second(10);
42 Expect.equals(10, obj.instance_a); 42 Expect.equals(10, obj.instance_a);
43 obj.instance_a = 20; 43 obj.instance_a = 20;
44 Expect.equals(30, obj.instance_a); 44 Expect.equals(30, obj.instance_a);
45 45
46 Second.testStaticMethod(); 46 Second.testStaticMethod();
47 Expect.equals(20, Second.c); 47 Expect.equals(20, Second.c);
48 Expect.equals(20, Second.static_d); 48 Expect.equals(20, Second.static_d);
49 } 49 }
50 } 50 }
51 51
52 52
53 main() { 53 main() {
54 Setter0Test.testMain(); 54 Setter0Test.testMain();
55 } 55 }
OLDNEW
« no previous file with comments | « dart/tests/language/resolution_test.dart ('k') | dart/tests/language/setter1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698