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 trace_test; | 5 library trace_test; |
6 | 6 |
7 import 'package:path/path.dart' as path; | 7 import 'package:path/path.dart' as path; |
8 import 'package:stack_trace/stack_trace.dart'; | 8 import 'package:stack_trace/stack_trace.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 '''); | 276 '''); |
277 | 277 |
278 expect(trace.terse.toString(), equals(''' | 278 expect(trace.terse.toString(), equals(''' |
279 foo.dart 42:21 notCore | 279 foo.dart 42:21 notCore |
280 dart:core bottom | 280 dart:core bottom |
281 bar.dart 10:20 alsoNotCore | 281 bar.dart 10:20 alsoNotCore |
282 dart:async bottom | 282 dart:async bottom |
283 ''')); | 283 ''')); |
284 }); | 284 }); |
285 | 285 |
| 286 test('.terse folds empty async frames', () { |
| 287 var trace = new Trace.parse(''' |
| 288 #0 notCore (foo.dart:42:21) |
| 289 #1 top (dart:async/future.dart:0:2) |
| 290 #2 empty.<<anonymous closure>_async_body> (bar.dart) |
| 291 #3 bottom (dart:async-patch/future.dart:9:11) |
| 292 '''); |
| 293 |
| 294 expect(trace.terse.toString(), equals(''' |
| 295 foo.dart 42:21 notCore |
| 296 dart:async bottom |
| 297 ''')); |
| 298 }); |
| 299 |
286 test('.foldFrames folds frames together bottom-up', () { | 300 test('.foldFrames folds frames together bottom-up', () { |
287 var trace = new Trace.parse(''' | 301 var trace = new Trace.parse(''' |
288 #0 notFoo (foo.dart:42:21) | 302 #0 notFoo (foo.dart:42:21) |
289 #1 fooTop (bar.dart:0:2) | 303 #1 fooTop (bar.dart:0:2) |
290 #2 fooBottom (foo.dart:1:100) | 304 #2 fooBottom (foo.dart:1:100) |
291 #3 alsoNotFoo (bar.dart:10:20) | 305 #3 alsoNotFoo (bar.dart:10:20) |
292 #4 fooTop (dart:io/socket.dart:5:10) | 306 #4 fooTop (dart:io/socket.dart:5:10) |
293 #5 fooBottom (dart:async-patch/future.dart:9:11) | 307 #5 fooBottom (dart:async-patch/future.dart:9:11) |
294 '''); | 308 '''); |
295 | 309 |
296 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); | 310 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); |
297 expect(folded.toString(), equals(''' | 311 expect(folded.toString(), equals(''' |
298 foo.dart 42:21 notFoo | 312 foo.dart 42:21 notFoo |
299 foo.dart 1:100 fooBottom | 313 foo.dart 1:100 fooBottom |
300 bar.dart 10:20 alsoNotFoo | 314 bar.dart 10:20 alsoNotFoo |
301 dart:async-patch/future.dart 9:11 fooBottom | 315 dart:async-patch/future.dart 9:11 fooBottom |
302 ''')); | 316 ''')); |
303 }); | 317 }); |
304 } | 318 } |
OLD | NEW |