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

Unified Diff: samples/tests/samples/src/proxy/MintMakerFullyIsolated_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/MintMakerFullyIsolated_generatedTest.dart
diff --git a/samples/tests/samples/src/proxy/MintMakerFullyIsolated_generatedTest.dart b/samples/tests/samples/src/proxy/MintMakerFullyIsolated_generatedTest.dart
index 15bf92859509004c763b7cd6c145832acd70b9db..a64fb2809dd0f21f46c5e054aa380c586b4ccb8e 100644
--- a/samples/tests/samples/src/proxy/MintMakerFullyIsolated_generatedTest.dart
+++ b/samples/tests/samples/src/proxy/MintMakerFullyIsolated_generatedTest.dart
@@ -6,7 +6,7 @@
#library("MintMakerFullyIsolatedTest_generatedTest");
#import("dart:isolate");
#import("../../../../proxy/promise.dart");
-#import("../../../../../tests/isolate/src/TestFramework.dart");
+#import("../../../../../lib/unittest/unittest.dart");
/* class = Purse (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintMakerFullyIsolatedTest.dart: 9) */
@@ -459,64 +459,56 @@ class PurseImpl implements PowerfulPurse {
}
-class MintMakerFullyIsolatedTest {
-
- static completesWithValue(
- TestExpectation expect, Promise promise, var expected) {
- promise.then(expect.runs1((value) {
- Expect.equals(expected, value);
- }));
- }
+_completesWithValue(Promise promise, var expected) {
+ promise.then(later1((value) {
+ Expect.equals(expected, value);
+ }));
+}
- static void testMain(TestExpectation expect) {
+main() {
+ test("MintMakerFullyIsolatedTest", () {
Mint$Proxy mint = new Mint$ProxyImpl.createIsolate();
Purse$Proxy purse = mint.createPurse(100);
// FIXME(benl): how do I write this?
//PowerfulPurse$Proxy power = (PowerfulPurse$Proxy)purse;
//expectEqualsStr("xxx", power.grab());
Promise<int> balance = purse.queryBalance();
- completesWithValue(expect, balance, 100);
+ _completesWithValue(balance, 100);
Purse$Proxy sprouted = purse.sproutPurse();
- completesWithValue(expect, sprouted.queryBalance(), 0);
+ _completesWithValue(sprouted.queryBalance(), 0);
Promise<int> done = sprouted.deposit(5, purse);
Promise<int> d3 = done;
- completesWithValue(expect, done, 5);
+ _completesWithValue(done, 5);
Promise<int> inner = new Promise<int>();
Promise<int> inner2 = new Promise<int>();
// FIXME(benl): it should not be necessary to wait here, I think,
// but without this, the tests seem to execute prematurely.
Promise<int> d1 = done.then((val) {
- completesWithValue(expect, sprouted.queryBalance(), 0 + 5);
- completesWithValue(expect, purse.queryBalance(), 100 - 5);
+ _completesWithValue(sprouted.queryBalance(), 0 + 5);
+ _completesWithValue(purse.queryBalance(), 100 - 5);
done = sprouted.deposit(42, purse);
- completesWithValue(expect, done, 5 + 42);
+ _completesWithValue(done, 5 + 42);
Promise<int> d2 = done.then((val_) {
Promise<int> bal1 = sprouted.queryBalance();
- completesWithValue(expect, bal1, 0 + 5 + 42);
- bal1.then(expect.runs1((int value) => inner.complete(0)));
+ _completesWithValue(bal1, 0 + 5 + 42);
+ bal1.then(later1((int value) => inner.complete(0)));
Promise<int> bal2 = purse.queryBalance();
- completesWithValue(expect, bal2, 100 - 5 - 42);
- bal2.then(expect.runs1((int value) => inner2.complete(0)));
+ _completesWithValue(bal2, 100 - 5 - 42);
+ bal2.then(later1((int value) => inner2.complete(0)));
return 0;
});
- completesWithValue(expect, d2, 0);
+ _completesWithValue(d2, 0);
return 0;
});
- completesWithValue(expect, d1, 0);
+ _completesWithValue(d1, 0);
Promise<int> allDone = new Promise<int>();
allDone.waitFor([d3, inner, inner2], 3);
allDone.then((_) {
- expect.succeeded();
print("##DONE##");
});
- }
-
-}
-
-main() {
- runTests([MintMakerFullyIsolatedTest.testMain]);
+ });
}

Powered by Google App Engine
This is Rietveld 408576698