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

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

Issue 10828344: Update tests to new 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
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 class GettersSettersTest { 5 class GettersSettersTest {
6 6
7 static int foo; 7 static int foo;
8 8
9 static testMain() { 9 static testMain() {
10 A a = new A(); 10 A a = new A();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 Expect.equals(1, rf.getIt()); 55 Expect.equals(1, rf.getIt());
56 rf.setIt(2); 56 rf.setIt(2);
57 Expect.equals(2, rf.x_); 57 Expect.equals(2, rf.x_);
58 } 58 }
59 } 59 }
60 60
61 class A { 61 class A {
62 int x_; 62 int x_;
63 static int foo; 63 static int foo;
64 64
65 static get bar() { 65 static get bar {
66 return foo; 66 return foo;
67 } 67 }
68 68
69 static set bar(newValue) { 69 static set bar(newValue) {
70 foo = newValue; 70 foo = newValue;
71 } 71 }
72 72
73 int get x() { 73 int get x {
74 return x_; 74 return x_;
75 } 75 }
76 76
77 void set x(int value) { 77 void set x(int value) {
78 x_ = value; 78 x_ = value;
79 } 79 }
80 80
81 bool isXPositive() { 81 bool isXPositive() {
82 return x > 0; 82 return x > 0;
83 } 83 }
(...skipping 13 matching lines...) Expand all
97 97
98 class B extends A { } 98 class B extends A { }
99 99
100 class C extends A { 100 class C extends A {
101 int y_; 101 int y_;
102 102
103 C() : super() { 103 C() : super() {
104 this.x_ = 0; 104 this.x_ = 0;
105 } 105 }
106 106
107 int get x() { 107 int get x {
108 return y_; 108 return y_;
109 } 109 }
110 110
111 void set x(int value) { 111 void set x(int value) {
112 y_ = value; 112 y_ = value;
113 } 113 }
114 } 114 }
115 115
116 class D extends A { 116 class D extends A {
117 var x2_; 117 var x2_;
118 118
119 set x(new_x) { 119 set x(new_x) {
120 x2_ = new_x; 120 x2_ = new_x;
121 } 121 }
122 122
123 test() { 123 test() {
124 x = 87; 124 x = 87;
125 Expect.equals(87, x2_); 125 Expect.equals(87, x2_);
126 x = 42; 126 x = 42;
127 Expect.equals(42, x2_); 127 Expect.equals(42, x2_);
128 } 128 }
129 } 129 }
130 130
131 class OverrideField extends A { 131 class OverrideField extends A {
132 int get x_() { 132 int get x_ {
133 return 27; 133 return 27;
134 } 134 }
135 } 135 }
136 136
137 class ReferenceField extends A { 137 class ReferenceField extends A {
138 setIt(a) { 138 setIt(a) {
139 super.x_ = a; 139 super.x_ = a;
140 } 140 }
141 141
142 int getIt() { 142 int getIt() {
143 return super.x_; 143 return super.x_;
144 } 144 }
145 } 145 }
146 146
147 main() { 147 main() {
148 GettersSettersTest.testMain(); 148 GettersSettersTest.testMain();
149 } 149 }
OLDNEW
« no previous file with comments | « dart/tests/language/function_syntax_test.dart ('k') | dart/tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698