Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1350)

Unified Diff: test/trace_test.dart

Issue 1283113002: Don't throw for unparseable frames. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Code review changes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/frame_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/trace_test.dart
diff --git a/test/trace_test.dart b/test/trace_test.dart
index 14e1e2bd1c5066c2fc4230a95df2afd25e86a46b..1cc32f7ccacf4390cf8a87f50a91c331bc9ffea4 100644
--- a/test/trace_test.dart
+++ b/test/trace_test.dart
@@ -293,8 +293,9 @@ http://pub.dartlang.org/thing.dart 1:100 zip.<fn>.zap
'#3 baz (dart:async:15:0)\n'));
});
- test('.terse folds core frames together bottom-up', () {
- var trace = new Trace.parse('''
+ group("folding", () {
+ test('.terse folds core frames together bottom-up', () {
+ var trace = new Trace.parse('''
#1 top (dart:async/future.dart:0:2)
#2 bottom (dart:core/uri.dart:1:100)
#0 notCore (foo.dart:42:21)
@@ -303,30 +304,30 @@ http://pub.dartlang.org/thing.dart 1:100 zip.<fn>.zap
#5 alsoNotCore (bar.dart:10:20)
''');
- expect(trace.terse.toString(), equals('''
+ expect(trace.terse.toString(), equals('''
dart:core bottom
foo.dart 42:21 notCore
dart:async bottom
bar.dart 10:20 alsoNotCore
'''));
- });
+ });
- test('.terse folds empty async frames', () {
- var trace = new Trace.parse('''
+ test('.terse folds empty async frames', () {
+ var trace = new Trace.parse('''
#0 top (dart:async/future.dart:0:2)
#1 empty.<<anonymous closure>_async_body> (bar.dart)
#2 bottom (dart:async-patch/future.dart:9:11)
#3 notCore (foo.dart:42:21)
''');
- expect(trace.terse.toString(), equals('''
+ expect(trace.terse.toString(), equals('''
dart:async bottom
foo.dart 42:21 notCore
'''));
- });
+ });
- test('.terse removes the bottom-most async frame', () {
- var trace = new Trace.parse('''
+ test('.terse removes the bottom-most async frame', () {
+ var trace = new Trace.parse('''
#0 notCore (foo.dart:42:21)
#1 top (dart:async/future.dart:0:2)
#2 bottom (dart:core/uri.dart:1:100)
@@ -334,32 +335,28 @@ foo.dart 42:21 notCore
#4 bottom (dart:async-patch/future.dart:9:11)
''');
- expect(trace.terse.toString(), equals('''
+ expect(trace.terse.toString(), equals('''
foo.dart 42:21 notCore
'''));
- });
+ });
- test(".terse won't make a trace empty", () {
- var trace = new Trace.parse('''
+ test(".terse won't make a trace empty", () {
+ var trace = new Trace.parse('''
#1 top (dart:async/future.dart:0:2)
#2 bottom (dart:core/uri.dart:1:100)
''');
- expect(trace.terse.toString(), equals('''
+ expect(trace.terse.toString(), equals('''
dart:core bottom
'''));
- });
-
- test(".terse won't panic on an empty trace", () {
- var trace = new Trace.parse('''
-''');
+ });
- expect(trace.terse.toString(), equals('''
-'''));
- });
+ test(".terse won't panic on an empty trace", () {
+ expect(Trace.parse("").terse.toString(), equals(""));
+ });
- test('.foldFrames folds frames together bottom-up', () {
- var trace = new Trace.parse('''
+ test('.foldFrames folds frames together bottom-up', () {
+ var trace = new Trace.parse('''
#0 notFoo (foo.dart:42:21)
#1 fooTop (bar.dart:0:2)
#2 fooBottom (foo.dart:1:100)
@@ -368,17 +365,17 @@ dart:core bottom
#5 fooBottom (dart:async-patch/future.dart:9:11)
''');
- var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'));
- expect(folded.toString(), equals('''
+ var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'));
+ expect(folded.toString(), equals('''
foo.dart 42:21 notFoo
foo.dart 1:100 fooBottom
bar.dart 10:20 alsoNotFoo
dart:async-patch/future.dart 9:11 fooBottom
'''));
- });
+ });
- test('.foldFrames with terse: true folds core frames as well', () {
- var trace = new Trace.parse('''
+ test('.foldFrames with terse: true folds core frames as well', () {
+ var trace = new Trace.parse('''
#0 notFoo (foo.dart:42:21)
#1 fooTop (bar.dart:0:2)
#2 coreBottom (dart:async/future.dart:0:2)
@@ -387,17 +384,17 @@ dart:async-patch/future.dart 9:11 fooBottom
#5 coreBottom (dart:async-patch/future.dart:9:11)
''');
- var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'),
- terse: true);
- expect(folded.toString(), equals('''
+ var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'),
+ terse: true);
+ expect(folded.toString(), equals('''
foo.dart 42:21 notFoo
dart:async coreBottom
bar.dart 10:20 alsoNotFoo
'''));
- });
+ });
- test('.foldFrames with terse: true shortens folded frames', () {
- var trace = new Trace.parse('''
+ test('.foldFrames with terse: true shortens folded frames', () {
+ var trace = new Trace.parse('''
#0 notFoo (foo.dart:42:21)
#1 fooTop (bar.dart:0:2)
#2 fooBottom (package:foo/bar.dart:0:2)
@@ -406,13 +403,28 @@ bar.dart 10:20 alsoNotFoo
#5 fooBottom (foo/bar.dart:9:11)
''');
- var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'),
- terse: true);
- expect(folded.toString(), equals('''
+ var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'),
+ terse: true);
+ expect(folded.toString(), equals('''
foo.dart 42:21 notFoo
package:foo fooBottom
bar.dart 10:20 alsoNotFoo
foo fooBottom
'''));
+ });
+
+ test('.foldFrames will never fold unparsed frames', () {
+ var trace = new Trace.parse(r'''
+.g"cs$#:b";a#>sw{*{ul$"$xqwr`p
+%+j-?uppx<([j@#nu{{>*+$%x-={`{
+!e($b{nj)zs?cgr%!;bmw.+$j+pfj~
+''');
+
+ expect(trace.foldFrames((frame) => true).toString(), equals(r'''
+.g"cs$#:b";a#>sw{*{ul$"$xqwr`p
+%+j-?uppx<([j@#nu{{>*+$%x-={`{
+!e($b{nj)zs?cgr%!;bmw.+$j+pfj~
+'''));
+ });
});
}
« no previous file with comments | « test/frame_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698