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

Side by Side Diff: tests/stub-generator/src/MintMakerFullyIsolatedTest-generatedTest.dart

Issue 9017015: Dartc was not raising an error if an interface declared constructors without a default clause (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated the stub-generator tests to get rid of errors Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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=MintMakerFullyIsolatedTest.dart:Mint,Purse,PowerfulPurse 5 // IsolateStubs=MintMakerFullyIsolatedTest.dart:Mint,Purse,PowerfulPurse
6 #library("MintMakerFullyIsolatedTest-generatedTest"); 6 #library("MintMakerFullyIsolatedTest-generatedTest");
7 #import("../../isolate/src/TestFramework.dart"); 7 #import("../../isolate/src/TestFramework.dart");
8 8
9 /* class = Purse (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintM akerFullyIsolatedTest.dart: 9) */ 9 /* class = Purse (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintM akerFullyIsolatedTest.dart: 9) */
10 10
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 void main() { 210 void main() {
211 this.port.receive(void _(var message, SendPort replyTo) { 211 this.port.receive(void _(var message, SendPort replyTo) {
212 Mint thing = new Mint(); 212 Mint thing = new Mint();
213 SendPort port = Dispatcher.serve(new Mint$Dispatcher(thing)); 213 SendPort port = Dispatcher.serve(new Mint$Dispatcher(thing));
214 Proxy proxy = new Proxy.forPort(replyTo); 214 Proxy proxy = new Proxy.forPort(replyTo);
215 proxy.send([port]); 215 proxy.send([port]);
216 }); 216 });
217 } 217 }
218 } 218 }
219 interface Purse { 219 interface Purse default PurseImpl{
220 Purse(); 220 Purse();
221 int queryBalance(); 221 int queryBalance();
222 Purse$Proxy sproutPurse(); 222 Purse$Proxy sproutPurse();
223 // The deposit has not completed until the promise completes. If we 223 // The deposit has not completed until the promise completes. If we
224 // supported Promise<void> then this could use that. 224 // supported Promise<void> then this could use that.
225 Promise<int> deposit(int amount, Purse$Proxy source); 225 Promise<int> deposit(int amount, Purse$Proxy source);
226 } 226 }
227 227
228 interface PowerfulPurse extends Purse default PurseImpl { 228 interface PowerfulPurse extends Purse default PurseImpl {
229 PowerfulPurse(); 229 PowerfulPurse();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 s.addCompleteHandler((_) { 324 s.addCompleteHandler((_) {
325 print("PromiseMap.add move to map"); 325 print("PromiseMap.add move to map");
326 _map[s] = t; 326 _map[s] = t;
327 _incomplete.remove(s); 327 _incomplete.remove(s);
328 }); 328 });
329 return t; 329 return t;
330 } 330 }
331 331
332 Promise<T> find(S s) { 332 Promise<T> find(S s) {
333 print("PromiseMap.find"); 333 print("PromiseMap.find");
334 Promise<T> result = new Promise<T>(); 334 Promise<T> findResult = new Promise<T>();
335 s.addCompleteHandler((_) { 335 s.addCompleteHandler((unused) {
336 print("PromiseMap.find s completed"); 336 print("PromiseMap.find s completed");
337 T t = _map[s]; 337 T t = _map[s];
338 if (t != null) { 338 if (t != null) {
339 print(" immediate"); 339 print(" immediate");
340 result.complete(t); 340 findResult.complete(t);
341 return; 341 return;
342 } 342 }
343 // Otherwise, we need to wait for map[s] to complete... 343 // Otherwise, we need to wait for map[s] to complete...
344 int counter = _incomplete.length; 344 int counter = _incomplete.length;
345 if (counter == 0) { 345 if (counter == 0) {
346 print(" none incomplete"); 346 print(" none incomplete");
347 result.complete(null); 347 findResult.complete(null);
348 return; 348 return;
349 } 349 }
350 result.join(_incomplete, bool (S completed) { 350 findResult.join(_incomplete, bool _(S completed) {
351 if (completed != s) { 351 if (completed != s) {
352 if (--counter == 0) { 352 if (--counter == 0) {
353 print("PromiseMap.find failed"); 353 print("PromiseMap.find failed");
354 result.complete(null); 354 findResult.complete(null);
355 return true; 355 return true;
356 } 356 }
357 print("PromiseMap.find miss"); 357 print("PromiseMap.find miss");
358 return false; 358 return false;
359 } 359 }
360 print("PromiseMap.find complete"); 360 print("PromiseMap.find complete");
361 result.complete(_map[s]); 361 findResult.complete(_map[s]);
362 return true; 362 return true;
363 }); 363 });
364 }); 364 });
365 return result; 365 return findResult;
366 } 366 }
367 367
368 PromiseSet<S> _incomplete; 368 PromiseSet<S> _incomplete;
369 Map<S, T> _map; 369 Map<S, T> _map;
370 370
371 } 371 }
372 372
373 373
374 class MintImpl implements Mint { 374 class MintImpl implements Mint {
375 375
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 Promise<int> inner = new Promise<int>(); 475 Promise<int> inner = new Promise<int>();
476 Promise<int> inner2 = new Promise<int>(); 476 Promise<int> inner2 = new Promise<int>();
477 // FIXME(benl): it should not be necessary to wait here, I think, 477 // FIXME(benl): it should not be necessary to wait here, I think,
478 // but without this, the tests seem to execute prematurely. 478 // but without this, the tests seem to execute prematurely.
479 Promise<int> d1 = done.then((val) { 479 Promise<int> d1 = done.then((val) {
480 expect.completesWithValue(sprouted.queryBalance(), 0 + 5); 480 expect.completesWithValue(sprouted.queryBalance(), 0 + 5);
481 expect.completesWithValue(purse.queryBalance(), 100 - 5); 481 expect.completesWithValue(purse.queryBalance(), 100 - 5);
482 482
483 done = sprouted.deposit(42, purse); 483 done = sprouted.deposit(42, purse);
484 expect.completesWithValue(done, 5 + 42); 484 expect.completesWithValue(done, 5 + 42);
485 Promise<int> d2 = done.then((val) { 485 Promise<int> d2 = done.then((val_) {
486 expect.completesWithValue(sprouted.queryBalance(), 0 + 5 + 42) 486 expect.completesWithValue(sprouted.queryBalance(), 0 + 5 + 42)
487 .then((int value) => inner.complete(0)); 487 .then((int value) => inner.complete(0));
488 expect.completesWithValue(purse.queryBalance(), 100 - 5 - 42) 488 expect.completesWithValue(purse.queryBalance(), 100 - 5 - 42)
489 .then((int value) => inner2.complete(0)); 489 .then((int value) => inner2.complete(0));
490 }); 490 });
491 expect.completes(d2); 491 expect.completes(d2);
492 492
493 return 0; 493 return 0;
494 }); 494 });
495 expect.completesWithValue(d1, 0); 495 expect.completesWithValue(d1, 0);
496 Promise<int> allDone = new Promise<int>(); 496 Promise<int> allDone = new Promise<int>();
497 allDone.waitFor([d3, inner, inner2], 3); 497 allDone.waitFor([d3, inner, inner2], 3);
498 allDone.then((_) { 498 allDone.then((_) {
499 expect.succeeded(); 499 expect.succeeded();
500 print("##DONE##"); 500 print("##DONE##");
501 }); 501 });
502 } 502 }
503 503
504 } 504 }
505 505
506 main() { 506 main() {
507 runTests([MintMakerFullyIsolatedTest.testMain]); 507 runTests([MintMakerFullyIsolatedTest.testMain]);
508 } 508 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698