| 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 // IsolateStubs=MintMakerPromiseWithStubsTest.dart:Mint,Purse | 5 // IsolateStubs=MintMakerPromiseWithStubsTest.dart:Mint,Purse |
| 6 | 6 |
| 7 #library("MintMakerPromiseWithStubsTest-generatedTest"); | 7 #library("MintMakerPromiseWithStubsTest-generatedTest"); |
| 8 #import("../../isolate/src/TestFramework.dart"); | 8 #import("../../isolate/src/TestFramework.dart"); |
| 9 | 9 |
| 10 /* class = Mint (tests/stub-generator/src/MintMakerPromiseWithStubsTest.dart/Min
tMakerPromiseWithStubsTest.dart: 10) */ | 10 /* class = Mint (tests/stub-generator/src/MintMakerPromiseWithStubsTest.dart/Min
tMakerPromiseWithStubsTest.dart: 10) */ |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 // FIXME(benl): We should not have to manually order the calls | 219 // FIXME(benl): We should not have to manually order the calls |
| 220 // like this. | 220 // like this. |
| 221 Promise<int> result = sprouted.deposit(5, purse); | 221 Promise<int> result = sprouted.deposit(5, purse); |
| 222 Promise p1 = expect.completesWithValue(result, 5); | 222 Promise p1 = expect.completesWithValue(result, 5); |
| 223 Promise<bool> p2 = new Promise<bool>(); | 223 Promise<bool> p2 = new Promise<bool>(); |
| 224 Promise<bool> p3 = new Promise<bool>(); | 224 Promise<bool> p3 = new Promise<bool>(); |
| 225 Promise<bool> p4 = new Promise<bool>(); | 225 Promise<bool> p4 = new Promise<bool>(); |
| 226 Promise<bool> p5 = new Promise<bool>(); | 226 Promise<bool> p5 = new Promise<bool>(); |
| 227 Promise<bool> p6 = new Promise<bool>(); | 227 Promise<bool> p6 = new Promise<bool>(); |
| 228 result.addCompleteHandler((_) { | 228 result.addCompleteHandler((unused) { |
| 229 expect.completesWithValue(sprouted.queryBalance(), 0 + 5) | 229 expect.completesWithValue(sprouted.queryBalance(), 0 + 5) |
| 230 .then((_) => p2.complete(true)); | 230 .then((unused_) => p2.complete(true)); |
| 231 expect.completesWithValue(purse.queryBalance(), 100 - 5) | 231 expect.completesWithValue(purse.queryBalance(), 100 - 5) |
| 232 .then((_) => p3.complete(true)); | 232 .then((unused_) => p3.complete(true)); |
| 233 | 233 |
| 234 result = sprouted.deposit(42, purse); | 234 result = sprouted.deposit(42, purse); |
| 235 expect.completesWithValue(result, 5 + 42).then((_) => p4.complete(true)); | 235 expect.completesWithValue(result, 5 + 42).then((unused__) => p4.complete(t
rue)); |
| 236 result.addCompleteHandler((_) { | 236 result.addCompleteHandler((unused_) { |
| 237 expect.completesWithValue(sprouted.queryBalance(), 0 + 5 + 42) | 237 expect.completesWithValue(sprouted.queryBalance(), 0 + 5 + 42) |
| 238 .then((_) => p5.complete(true)); | 238 .then((unused___) => p5.complete(true)); |
| 239 expect.completesWithValue(purse.queryBalance(), 100 - 5 - 42) | 239 expect.completesWithValue(purse.queryBalance(), 100 - 5 - 42) |
| 240 .then((_) => p6.complete(true)); | 240 .then((unused___) => p6.complete(true)); |
| 241 }); | 241 }); |
| 242 }); | 242 }); |
| 243 Promise<bool> done = new Promise<bool>(); | 243 Promise<bool> done = new Promise<bool>(); |
| 244 done.waitFor([p1, p2, p3, p4, p5, p6], 6); | 244 done.waitFor([p1, p2, p3, p4, p5, p6], 6); |
| 245 done.then((_) { | 245 done.then((_) { |
| 246 expect.succeeded(); | 246 expect.succeeded(); |
| 247 print("##DONE##"); | 247 print("##DONE##"); |
| 248 }); | 248 }); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } | 251 } |
| 252 | 252 |
| 253 main() { | 253 main() { |
| 254 runTests([MintMakerPromiseWithStubsTest.testMain]); | 254 runTests([MintMakerPromiseWithStubsTest.testMain]); |
| 255 } | 255 } |
| OLD | NEW |