| OLD | NEW | 
|---|
| 1 // Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; | 
| 6 | 6 | 
| 7 import 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; | 
| 8 import 'package:stack_trace/stack_trace.dart'; | 8 import 'package:stack_trace/stack_trace.dart'; | 
| 9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; | 
| 10 | 10 | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 102             'package:stack_trace/stack_trace.dart 10:11  Bar.baz\n' | 102             'package:stack_trace/stack_trace.dart 10:11  Bar.baz\n' | 
| 103             'dart:core 10:11                             Zip.zap'), | 103             'dart:core 10:11                             Zip.zap'), | 
| 104         new Trace.parse( | 104         new Trace.parse( | 
| 105             'dart:core 10:11                             A.b\n' | 105             'dart:core 10:11                             A.b\n' | 
| 106             'package:stack_trace/stack_trace.dart 10:11  C.d\n' | 106             'package:stack_trace/stack_trace.dart 10:11  C.d\n' | 
| 107             'dart:core 10:11                             E.f') | 107             'dart:core 10:11                             E.f') | 
| 108       ]); | 108       ]); | 
| 109 | 109 | 
| 110       expect(chain.terse.toString(), equals('dart:core  E.f\n')); | 110       expect(chain.terse.toString(), equals('dart:core  E.f\n')); | 
| 111     }); | 111     }); | 
|  | 112 | 
|  | 113     // Regression test for #9 | 
|  | 114     test("doesn't crash on empty traces", () { | 
|  | 115       var chain = new Chain([ | 
|  | 116         new Trace.parse('user/code.dart 10:11  Bang.qux'), | 
|  | 117         new Trace([]), | 
|  | 118         new Trace.parse('user/code.dart 10:11  Bang.qux') | 
|  | 119       ]); | 
|  | 120 | 
|  | 121       expect(chain.terse.toString(), equals( | 
|  | 122           '$userSlashCode 10:11  Bang.qux\n' | 
|  | 123           '===== asynchronous gap ===========================\n' | 
|  | 124           '$userSlashCode 10:11  Bang.qux\n')); | 
|  | 125     }); | 
| 112   }); | 126   }); | 
| 113 | 127 | 
| 114   group('Chain.foldFrames', () { | 128   group('Chain.foldFrames', () { | 
| 115     test('folds each trace', () { | 129     test('folds each trace', () { | 
| 116       var chain = new Chain([ | 130       var chain = new Chain([ | 
| 117         new Trace.parse( | 131         new Trace.parse( | 
| 118             'a.dart 10:11  Foo.bar\n' | 132             'a.dart 10:11  Foo.bar\n' | 
| 119             'a.dart 10:11  Bar.baz\n' | 133             'a.dart 10:11  Bar.baz\n' | 
| 120             'b.dart 10:11  Bang.qux\n' | 134             'b.dart 10:11  Bang.qux\n' | 
| 121             'a.dart 10:11  Zip.zap\n' | 135             'a.dart 10:11  Zip.zap\n' | 
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 273         controller = new StreamController()..addError('error', trace); | 287         controller = new StreamController()..addError('error', trace); | 
| 274         expect(Chain.track(controller.stream).toList() | 288         expect(Chain.track(controller.stream).toList() | 
| 275             .catchError((e, stackTrace) { | 289             .catchError((e, stackTrace) { | 
| 276           expect(e, equals('error')); | 290           expect(e, equals('error')); | 
| 277           expect(stackTrace.toString(), equals(trace.toString())); | 291           expect(stackTrace.toString(), equals(trace.toString())); | 
| 278         }), completes); | 292         }), completes); | 
| 279       }); | 293       }); | 
| 280     }); | 294     }); | 
| 281   }); | 295   }); | 
| 282 } | 296 } | 
| OLD | NEW | 
|---|