OLD | NEW |
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 | 4 |
5 // Things that should be "auto-generated" are between AUTO START and | 5 // Things that should be "auto-generated" are between AUTO START and |
6 // AUTO END (or just AUTO if it's a single line). | 6 // AUTO END (or just AUTO if it's a single line). |
7 | 7 |
8 | 8 |
9 class Mint { | 9 class Mint { |
10 Mint() : registry_ = new Map<SendPort, Purse>() { | 10 Mint() : registry_ = new Map<SendPort, Purse>() { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 void makeMint(handleMint(MintWrapper mint)) { | 177 void makeMint(handleMint(MintWrapper mint)) { |
178 port_.then((SendPort port) { | 178 port_.then((SendPort port) { |
179 port.call(null).receive((var message, SendPort replyTo) { | 179 port.call(null).receive((var message, SendPort replyTo) { |
180 SendPort mint = message[0]; | 180 SendPort mint = message[0]; |
181 handleMint(new MintWrapper(mint)); | 181 handleMint(new MintWrapper(mint)); |
182 }); | 182 }); |
183 }); | 183 }); |
184 } | 184 } |
185 | 185 |
186 Promise<SendPort> port_; | 186 Future<SendPort> port_; |
187 } | 187 } |
188 | 188 |
189 | 189 |
190 class MintMakerTest { | 190 class MintMakerTest { |
191 static void testMain() { | 191 static void testMain() { |
192 MintMakerWrapper mintMaker = new MintMakerWrapper(); | 192 MintMakerWrapper mintMaker = new MintMakerWrapper(); |
193 mintMaker.makeMint((MintWrapper mint) { | 193 mintMaker.makeMint((MintWrapper mint) { |
194 mint.createPurse(100, (PurseWrapper purse) { | 194 mint.createPurse(100, (PurseWrapper purse) { |
195 purse.queryBalance((int balance) { | 195 purse.queryBalance((int balance) { |
196 Expect.equals(100, balance); | 196 Expect.equals(100, balance); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 Expect.equals(0 + 5 + 42, sprouted.queryBalance()); | 263 Expect.equals(0 + 5 + 42, sprouted.queryBalance()); |
264 Expect.equals(100 - 5 - 42, purse.queryBalance()); | 264 Expect.equals(100 - 5 - 42, purse.queryBalance()); |
265 } | 265 } |
266 */ | 266 */ |
267 | 267 |
268 } | 268 } |
269 | 269 |
270 main() { | 270 main() { |
271 MintMakerTest.testMain(); | 271 MintMakerTest.testMain(); |
272 } | 272 } |
OLD | NEW |