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

Unified Diff: tests/isolate/src/MintMakerTest.dart

Issue 10226008: Revert "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
« no previous file with comments | « tests/isolate/src/MessageTest.dart ('k') | tests/isolate/src/Mixed2Test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/src/MintMakerTest.dart
diff --git a/tests/isolate/src/MintMakerTest.dart b/tests/isolate/src/MintMakerTest.dart
index 72e1597e5fdad9d502246fab42943c715da15eae..2553422c1843f98729b7de3a21510bc2643637ac 100644
--- a/tests/isolate/src/MintMakerTest.dart
+++ b/tests/isolate/src/MintMakerTest.dart
@@ -7,7 +7,7 @@
#library("MintMakerTest");
#import("dart:isolate");
-#import('../../../lib/unittest/unittest.dart');
+
class Mint {
Mint() : registry_ = new Map<SendPort, Purse>() {
@@ -189,33 +189,37 @@ class MintMakerWrapper {
Future<SendPort> port_;
}
-_checkBalance(PurseWrapper wrapper, expected) {
- wrapper.queryBalance(expectAsync1((int balance) {
- expect(balance).equals(expected);
- }));
-}
-main() {
- test("creating purse, deposit, and query balance", () {
+class MintMakerTest {
+ static void testMain() {
MintMakerWrapper mintMaker = new MintMakerWrapper();
- mintMaker.makeMint(expectAsync1((MintWrapper mint) {
- mint.createPurse(100, expectAsync1((PurseWrapper purse) {
- _checkBalance(purse, 100);
- purse.sproutPurse(expectAsync1((PurseWrapper sprouted) {
- _checkBalance(sprouted, 0);
- _checkBalance(purse, 100);
-
+ mintMaker.makeMint((MintWrapper mint) {
+ mint.createPurse(100, (PurseWrapper purse) {
+ purse.queryBalance((int balance) {
+ Expect.equals(100, balance);
+ });
+ purse.sproutPurse((PurseWrapper sprouted) {
+ sprouted.queryBalance((int balance) {
+ Expect.equals(0, balance);
+ });
sprouted.deposit(purse, 5);
- _checkBalance(sprouted, 0 + 5);
- _checkBalance(purse, 100 - 5);
-
+ sprouted.queryBalance((int balance) {
+ Expect.equals(0 + 5, balance);
+ });
+ purse.queryBalance((int balance) {
+ Expect.equals(100 - 5, balance);
+ });
sprouted.deposit(purse, 42);
- _checkBalance(sprouted, 0 + 5 + 42);
- _checkBalance(purse, 100 - 5 - 42);
- }));
- }));
- }));
- });
+ sprouted.queryBalance((int balance) {
+ Expect.equals(0 + 5 + 42, balance);
+ });
+ purse.queryBalance((int balance) {
+ Expect.equals(100 - 5 - 42, balance);
+ });
+ });
+ });
+ });
+ }
/* This is an attempt to show how the above code could look like if we had
* better language support for asynchronous messages (deferred/asynccall).
@@ -263,4 +267,9 @@ main() {
Expect.equals(100 - 5 - 42, purse.queryBalance());
}
*/
+
+}
+
+main() {
+ MintMakerTest.testMain();
}
« no previous file with comments | « tests/isolate/src/MessageTest.dart ('k') | tests/isolate/src/Mixed2Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698