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

Unified Diff: samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_generatedTest.dart

Issue 10153005: unittest step 3 and 4: remove TestFramework.dart, make test.dart use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_generatedTest.dart
diff --git a/samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_generatedTest.dart b/samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_generatedTest.dart
index 9695e0c28ff401f6a505d17fa6b04e3f67e43d3e..474d2013415efe558bdfac7593465e95a4d3de13 100644
--- a/samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_generatedTest.dart
+++ b/samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_generatedTest.dart
@@ -7,7 +7,7 @@
#library("MintMakerPromiseWithStubsTest_generatedTest");
#import("dart:isolate");
#import("../../../../proxy/promise.dart");
-#import("../../../../../tests/isolate/src/TestFramework.dart");
+#import("../../../../../lib/unittest/unittest.dart");
/* class = Mint (tests/stub-generator/src/MintMakerPromiseWithStubsTest.dart/MintMakerPromiseWithStubsTest.dart: 10) */
@@ -208,63 +208,55 @@ class PurseImpl implements Purse {
}
-class MintMakerPromiseWithStubsTest {
-
- static completesWithValue(
- TestExpectation expect, Promise promise, var expected) {
- promise.then(expect.runs1((value) {
- Expect.equals(expected, value);
- }));
- }
+_completesWithValue(Promise promise, var expected) {
+ promise.then(expectAsync1((value) {
+ Expect.equals(expected, value);
+ }));
+}
- static void testMain(TestExpectation expect) {
+main() {
+ test("MintMakerPromiseWithStubsTest", () {
Mint$Proxy mint = new Mint$ProxyImpl.createIsolate();
Purse$Proxy purse = mint.createPurse(100);
- completesWithValue(expect, purse.queryBalance(), 100);
+ _completesWithValue(purse.queryBalance(), 100);
Purse$Proxy sprouted = purse.sproutPurse();
- completesWithValue(expect, sprouted.queryBalance(), 0);
+ _completesWithValue(sprouted.queryBalance(), 0);
// FIXME(benl): We should not have to manually order the calls
// like this.
Promise<int> result = sprouted.deposit(5, purse);
Promise p1 = result;
- completesWithValue(expect, result, 5);
+ _completesWithValue(result, 5);
Promise<bool> p2 = new Promise<bool>();
Promise<bool> p3 = new Promise<bool>();
Promise<bool> p4 = new Promise<bool>();
Promise<bool> p5 = new Promise<bool>();
Promise<bool> p6 = new Promise<bool>();
- result.addCompleteHandler((unused) {
+ result.addCompleteHandler(expectAsync1((unused) {
Promise<int> bal1 = sprouted.queryBalance();
- completesWithValue(expect, bal1, 0 + 5);
- bal1.then(expect.runs1((unused_) => p2.complete(true)));
+ _completesWithValue(bal1, 0 + 5);
+ bal1.then(expectAsync1((unused_) => p2.complete(true)));
Promise<int> bal2 = purse.queryBalance();
- completesWithValue(expect, bal2, 100 - 5);
- bal2.then(expect.runs1((unused_) => p3.complete(true)));
+ _completesWithValue(bal2, 100 - 5);
+ bal2.then(expectAsync1((unused_) => p3.complete(true)));
result = sprouted.deposit(42, purse);
- completesWithValue(expect, result, 5 + 42);
- result.then(expect.runs1((unused__) => p4.complete(true)));
- result.addCompleteHandler((unused_) {
+ _completesWithValue(result, 5 + 42);
+ result.then(expectAsync1((unused__) => p4.complete(true)));
+ result.addCompleteHandler(expectAsync1((unused_) {
Promise<int> bal3 = sprouted.queryBalance();
- completesWithValue(expect, bal3, 0 + 5 + 42);
- bal3.then(expect.runs1((unused___) => p5.complete(true)));
+ _completesWithValue(bal3, 0 + 5 + 42);
+ bal3.then(expectAsync1((unused___) => p5.complete(true)));
Promise<int> bal4 = purse.queryBalance();
- completesWithValue(expect, bal4, 100 - 5 - 42);
- bal4.then(expect.runs1((unused___) => p6.complete(true)));
- });
- });
+ _completesWithValue(bal4, 100 - 5 - 42);
+ bal4.then(expectAsync1((unused___) => p6.complete(true)));
+ }));
+ }));
Promise<bool> done = new Promise<bool>();
done.waitFor([p1, p2, p3, p4, p5, p6], 6);
done.then((_) {
- expect.succeeded();
print("##DONE##");
});
- }
-
-}
-
-main() {
- runTests([MintMakerPromiseWithStubsTest.testMain]);
+ });
}

Powered by Google App Engine
This is Rietveld 408576698