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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 'a.dart 10:11 Bang.qux\n' | 583 'a.dart 10:11 Bang.qux\n' |
584 'a.dart 10:11 Zip.zap\n' | 584 'a.dart 10:11 Zip.zap\n' |
585 'b.dart 10:11 Zop.zoop') | 585 'b.dart 10:11 Zop.zoop') |
586 ]); | 586 ]); |
587 | 587 |
588 var folded = chain.foldFrames((frame) => frame.library == 'a.dart', | 588 var folded = chain.foldFrames((frame) => frame.library == 'a.dart', |
589 terse: true); | 589 terse: true); |
590 expect(folded.toString(), equals( | 590 expect(folded.toString(), equals( |
591 'dart:async Zip.zap\n' | 591 'dart:async Zip.zap\n' |
592 'b.dart 10:11 Bang.qux\n' | 592 'b.dart 10:11 Bang.qux\n' |
593 'a.dart 10:11 Zop.zoop\n' | 593 'a.dart Zop.zoop\n' |
594 '===== asynchronous gap ===========================\n' | 594 '===== asynchronous gap ===========================\n' |
595 'a.dart 10:11 Zip.zap\n' | 595 'a.dart Zip.zap\n' |
596 'b.dart 10:11 Zop.zoop\n')); | 596 'b.dart 10:11 Zop.zoop\n')); |
597 }); | 597 }); |
598 | 598 |
599 test('eliminates completely-folded traces', () { | 599 test('eliminates completely-folded traces', () { |
600 var chain = new Chain([ | 600 var chain = new Chain([ |
601 new Trace.parse( | 601 new Trace.parse( |
602 'a.dart 10:11 Foo.bar\n' | 602 'a.dart 10:11 Foo.bar\n' |
603 'b.dart 10:11 Bang.qux'), | 603 'b.dart 10:11 Bang.qux'), |
604 new Trace.parse( | 604 new Trace.parse( |
605 'a.dart 10:11 Foo.bar\n' | 605 'a.dart 10:11 Foo.bar\n' |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 /// | 787 /// |
788 /// [callback] is expected to throw the string `"error"`. | 788 /// [callback] is expected to throw the string `"error"`. |
789 Future<Chain> captureFuture(callback()) { | 789 Future<Chain> captureFuture(callback()) { |
790 var completer = new Completer<Chain>(); | 790 var completer = new Completer<Chain>(); |
791 Chain.capture(callback, onError: (error, chain) { | 791 Chain.capture(callback, onError: (error, chain) { |
792 expect(error, equals('error')); | 792 expect(error, equals('error')); |
793 completer.complete(chain); | 793 completer.complete(chain); |
794 }); | 794 }); |
795 return completer.future; | 795 return completer.future; |
796 } | 796 } |
OLD | NEW |