| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 'dart:core 10:11 Bar.baz') | 379 'dart:core 10:11 Bar.baz') |
| 380 ]); | 380 ]); |
| 381 | 381 |
| 382 expect(chain.terse.toString(), equals( | 382 expect(chain.terse.toString(), equals( |
| 383 '$userSlashCode 10:11 Foo.bar\n' | 383 '$userSlashCode 10:11 Foo.bar\n' |
| 384 'dart:core Bar.baz\n' | 384 'dart:core Bar.baz\n' |
| 385 '===== asynchronous gap ===========================\n' | 385 '===== asynchronous gap ===========================\n' |
| 386 '$userSlashCode 10:11 Foo.bar\n' | 386 '$userSlashCode 10:11 Foo.bar\n' |
| 387 'dart:core Bar.baz\n')); | 387 'dart:core Bar.baz\n')); |
| 388 }); | 388 }); |
| 389 |
| 390 test("doesn't return in an empty chain", () { |
| 391 var chain = new Chain([ |
| 392 new Trace.parse( |
| 393 'dart:core 10:11 Foo.bar\n' |
| 394 'package:stack_trace/stack_trace.dart 10:11 Bar.baz\n' |
| 395 'dart:core 10:11 Zip.zap'), |
| 396 new Trace.parse( |
| 397 'dart:core 10:11 A.b\n' |
| 398 'package:stack_trace/stack_trace.dart 10:11 C.d\n' |
| 399 'dart:core 10:11 E.f') |
| 400 ]); |
| 401 |
| 402 expect(chain.terse.toString(), equals('dart:core E.f\n')); |
| 403 }); |
| 389 }); | 404 }); |
| 390 | 405 |
| 391 test('Chain.toTrace eliminates asynchronous gaps', () { | 406 test('Chain.toTrace eliminates asynchronous gaps', () { |
| 392 var trace = new Chain([ | 407 var trace = new Chain([ |
| 393 new Trace.parse( | 408 new Trace.parse( |
| 394 'user/code.dart 10:11 Foo.bar\n' | 409 'user/code.dart 10:11 Foo.bar\n' |
| 395 'dart:core 10:11 Bar.baz'), | 410 'dart:core 10:11 Bar.baz'), |
| 396 new Trace.parse( | 411 new Trace.parse( |
| 397 'user/code.dart 10:11 Foo.bar\n' | 412 'user/code.dart 10:11 Foo.bar\n' |
| 398 'dart:core 10:11 Bar.baz') | 413 'dart:core 10:11 Bar.baz') |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 /// | 626 /// |
| 612 /// [callback] is expected to throw the string `"error"`. | 627 /// [callback] is expected to throw the string `"error"`. |
| 613 Future<Chain> captureFuture(callback()) { | 628 Future<Chain> captureFuture(callback()) { |
| 614 var completer = new Completer<Chain>(); | 629 var completer = new Completer<Chain>(); |
| 615 Chain.capture(callback, onError: (error, chain) { | 630 Chain.capture(callback, onError: (error, chain) { |
| 616 expect(error, equals('error')); | 631 expect(error, equals('error')); |
| 617 completer.complete(chain); | 632 completer.complete(chain); |
| 618 }); | 633 }); |
| 619 return completer.future; | 634 return completer.future; |
| 620 } | 635 } |
| OLD | NEW |