| 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 interface Mint default MintImpl { | 10 interface Mint default MintImpl { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // FIXME(benl): We should not have to manually order the calls | 93 // FIXME(benl): We should not have to manually order the calls |
| 94 // like this. | 94 // like this. |
| 95 Promise<int> result = sprouted.deposit(5, purse); | 95 Promise<int> result = sprouted.deposit(5, purse); |
| 96 Promise p1 = expect.completesWithValue(result, 5); | 96 Promise p1 = expect.completesWithValue(result, 5); |
| 97 Promise<bool> p2 = new Promise<bool>(); | 97 Promise<bool> p2 = new Promise<bool>(); |
| 98 Promise<bool> p3 = new Promise<bool>(); | 98 Promise<bool> p3 = new Promise<bool>(); |
| 99 Promise<bool> p4 = new Promise<bool>(); | 99 Promise<bool> p4 = new Promise<bool>(); |
| 100 Promise<bool> p5 = new Promise<bool>(); | 100 Promise<bool> p5 = new Promise<bool>(); |
| 101 Promise<bool> p6 = new Promise<bool>(); | 101 Promise<bool> p6 = new Promise<bool>(); |
| 102 result.addCompleteHandler((_) { | 102 result.addCompleteHandler((unused) { |
| 103 expect.completesWithValue(sprouted.queryBalance(), 0 + 5) | 103 expect.completesWithValue(sprouted.queryBalance(), 0 + 5) |
| 104 .then((_) => p2.complete(true)); | 104 .then((unused_) => p2.complete(true)); |
| 105 expect.completesWithValue(purse.queryBalance(), 100 - 5) | 105 expect.completesWithValue(purse.queryBalance(), 100 - 5) |
| 106 .then((_) => p3.complete(true)); | 106 .then((unused_) => p3.complete(true)); |
| 107 | 107 |
| 108 result = sprouted.deposit(42, purse); | 108 result = sprouted.deposit(42, purse); |
| 109 expect.completesWithValue(result, 5 + 42).then((_) => p4.complete(true)); | 109 expect.completesWithValue(result, 5 + 42).then((unused__) => p4.complete(t
rue)); |
| 110 result.addCompleteHandler((_) { | 110 result.addCompleteHandler((unused_) { |
| 111 expect.completesWithValue(sprouted.queryBalance(), 0 + 5 + 42) | 111 expect.completesWithValue(sprouted.queryBalance(), 0 + 5 + 42) |
| 112 .then((_) => p5.complete(true)); | 112 .then((unused___) => p5.complete(true)); |
| 113 expect.completesWithValue(purse.queryBalance(), 100 - 5 - 42) | 113 expect.completesWithValue(purse.queryBalance(), 100 - 5 - 42) |
| 114 .then((_) => p6.complete(true)); | 114 .then((unused___) => p6.complete(true)); |
| 115 }); | 115 }); |
| 116 }); | 116 }); |
| 117 Promise<bool> done = new Promise<bool>(); | 117 Promise<bool> done = new Promise<bool>(); |
| 118 done.waitFor([p1, p2, p3, p4, p5, p6], 6); | 118 done.waitFor([p1, p2, p3, p4, p5, p6], 6); |
| 119 done.then((_) { | 119 done.then((_) { |
| 120 expect.succeeded(); | 120 expect.succeeded(); |
| 121 print("##DONE##"); | 121 print("##DONE##"); |
| 122 }); | 122 }); |
| 123 } | 123 } |
| 124 | 124 |
| 125 } | 125 } |
| 126 | 126 |
| 127 main() { | 127 main() { |
| 128 runTests([MintMakerPromiseWithStubsTest.testMain]); | 128 runTests([MintMakerPromiseWithStubsTest.testMain]); |
| 129 } | 129 } |
| OLD | NEW |