OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library chain_test; | 5 library chain_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
10 import 'package:stack_trace/stack_trace.dart'; | 10 import 'package:stack_trace/stack_trace.dart'; |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 var folded = chain.foldFrames((frame) => frame.library == 'a.dart'); | 565 var folded = chain.foldFrames((frame) => frame.library == 'a.dart'); |
566 expect(folded.toString(), equals( | 566 expect(folded.toString(), equals( |
567 'a.dart 10:11 Bar.baz\n' | 567 'a.dart 10:11 Bar.baz\n' |
568 'b.dart 10:11 Bang.qux\n' | 568 'b.dart 10:11 Bang.qux\n' |
569 'a.dart 10:11 Zop.zoop\n' | 569 'a.dart 10:11 Zop.zoop\n' |
570 '===== asynchronous gap ===========================\n' | 570 '===== asynchronous gap ===========================\n' |
571 'a.dart 10:11 Zip.zap\n' | 571 'a.dart 10:11 Zip.zap\n' |
572 'b.dart 10:11 Zop.zoop\n')); | 572 'b.dart 10:11 Zop.zoop\n')); |
573 }); | 573 }); |
574 | 574 |
| 575 test('with terse: true, folds core frames as well', () { |
| 576 var chain = new Chain([ |
| 577 new Trace.parse( |
| 578 'a.dart 10:11 Foo.bar\n' |
| 579 'dart:async-patch/future.dart 10:11 Zip.zap\n' |
| 580 'b.dart 10:11 Bang.qux\n' |
| 581 'dart:core 10:11 Bar.baz\n' |
| 582 'a.dart 10:11 Zop.zoop'), |
| 583 new Trace.parse( |
| 584 'a.dart 10:11 Foo.bar\n' |
| 585 'a.dart 10:11 Bar.baz\n' |
| 586 'a.dart 10:11 Bang.qux\n' |
| 587 'a.dart 10:11 Zip.zap\n' |
| 588 'b.dart 10:11 Zop.zoop') |
| 589 ]); |
| 590 |
| 591 var folded = chain.foldFrames((frame) => frame.library == 'a.dart', |
| 592 terse: true); |
| 593 expect(folded.toString(), equals( |
| 594 'dart:async Zip.zap\n' |
| 595 'b.dart 10:11 Bang.qux\n' |
| 596 'a.dart 10:11 Zop.zoop\n' |
| 597 '===== asynchronous gap ===========================\n' |
| 598 'a.dart 10:11 Zip.zap\n' |
| 599 'b.dart 10:11 Zop.zoop\n')); |
| 600 }); |
| 601 |
575 test('eliminates completely-folded traces', () { | 602 test('eliminates completely-folded traces', () { |
576 var chain = new Chain([ | 603 var chain = new Chain([ |
577 new Trace.parse( | 604 new Trace.parse( |
578 'a.dart 10:11 Foo.bar\n' | 605 'a.dart 10:11 Foo.bar\n' |
579 'b.dart 10:11 Bang.qux'), | 606 'b.dart 10:11 Bang.qux'), |
580 new Trace.parse( | 607 new Trace.parse( |
581 'a.dart 10:11 Foo.bar\n' | 608 'a.dart 10:11 Foo.bar\n' |
582 'a.dart 10:11 Bang.qux'), | 609 'a.dart 10:11 Bang.qux'), |
583 new Trace.parse( | 610 new Trace.parse( |
584 'a.dart 10:11 Zip.zap\n' | 611 'a.dart 10:11 Zip.zap\n' |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 /// | 790 /// |
764 /// [callback] is expected to throw the string `"error"`. | 791 /// [callback] is expected to throw the string `"error"`. |
765 Future<Chain> captureFuture(callback()) { | 792 Future<Chain> captureFuture(callback()) { |
766 var completer = new Completer<Chain>(); | 793 var completer = new Completer<Chain>(); |
767 Chain.capture(callback, onError: (error, chain) { | 794 Chain.capture(callback, onError: (error, chain) { |
768 expect(error, equals('error')); | 795 expect(error, equals('error')); |
769 completer.complete(chain); | 796 completer.complete(chain); |
770 }); | 797 }); |
771 return completer.future; | 798 return completer.future; |
772 } | 799 } |
OLD | NEW |