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

Unified Diff: samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_testSource.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_testSource.dart
diff --git a/samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_testSource.dart b/samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_testSource.dart
index f360888de9bdbc2dbc0f892c9143c44b40ac37bf..d2c0f1de9d2145e407fb5dccd3c978d3ef30a031 100644
--- a/samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_testSource.dart
+++ b/samples/tests/samples/src/proxy/MintMakerPromiseWithStubs_testSource.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");
interface Mint default MintImpl {
@@ -82,27 +82,26 @@ class PurseImpl implements Purse {
}
-class MintMakerPromiseWithStubsTest {
-
- 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("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>();
@@ -110,34 +109,28 @@ class MintMakerPromiseWithStubsTest {
Promise<bool> p6 = new Promise<bool>();
result.addCompleteHandler((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(later1((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(later1((unused_) => p3.complete(true)));
result = sprouted.deposit(42, purse);
- completesWithValue(expect, result, 5 + 42);
- result.then(expect.runs1((unused__) => p4.complete(true)));
+ _completesWithValue(result, 5 + 42);
+ result.then(later1((unused__) => p4.complete(true)));
result.addCompleteHandler((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(later1((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(later1((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