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

Unified Diff: packages/stack_trace/test/frame_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 | « packages/stack_trace/test/chain/vm_test.dart ('k') | packages/stack_trace/test/trace_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/stack_trace/test/frame_test.dart
diff --git a/packages/stack_trace/test/frame_test.dart b/packages/stack_trace/test/frame_test.dart
index 63035e0e692867676d52fc060f96f9cd87f5be12..42df4cddfae878874c811e85c18a8ee5c916d59e 100644
--- a/packages/stack_trace/test/frame_test.dart
+++ b/packages/stack_trace/test/frame_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library frame_test;
-
import 'package:path/path.dart' as path;
import 'package:stack_trace/stack_trace.dart';
import 'package:test/test.dart';
@@ -13,8 +11,8 @@ void main() {
test('parses a stack frame with column correctly', () {
var frame = new Frame.parseVM("#1 Foo._bar "
"(file:///home/nweiz/code/stuff.dart:42:21)");
- expect(frame.uri,
- equals(Uri.parse("file:///home/nweiz/code/stuff.dart")));
+ expect(
+ frame.uri, equals(Uri.parse("file:///home/nweiz/code/stuff.dart")));
expect(frame.line, equals(42));
expect(frame.column, equals(21));
expect(frame.member, equals('Foo._bar'));
@@ -23,8 +21,8 @@ void main() {
test('parses a stack frame without column correctly', () {
var frame = new Frame.parseVM("#1 Foo._bar "
"(file:///home/nweiz/code/stuff.dart:24)");
- expect(frame.uri,
- equals(Uri.parse("file:///home/nweiz/code/stuff.dart")));
+ expect(
+ frame.uri, equals(Uri.parse("file:///home/nweiz/code/stuff.dart")));
expect(frame.line, equals(24));
expect(frame.column, null);
expect(frame.member, equals('Foo._bar'));
@@ -34,8 +32,8 @@ void main() {
test('parses a stack frame without line or column correctly', () {
var frame = new Frame.parseVM("#1 Foo._bar "
"(file:///home/nweiz/code/stuff.dart)");
- expect(frame.uri,
- equals(Uri.parse("file:///home/nweiz/code/stuff.dart")));
+ expect(
+ frame.uri, equals(Uri.parse("file:///home/nweiz/code/stuff.dart")));
expect(frame.line, isNull);
expect(frame.column, isNull);
expect(frame.member, equals('Foo._bar'));
@@ -57,8 +55,8 @@ void main() {
});
test('converts "<function_name_async_body>" to "<async>"', () {
- var frame = new Frame.parseVM(
- '#0 Foo.<function_name_async_body> (foo:0:0)');
+ var frame =
+ new Frame.parseVM('#0 Foo.<function_name_async_body> (foo:0:0)');
expect(frame.member, equals('Foo.<async>'));
});
@@ -70,7 +68,9 @@ void main() {
expect(frame.line, isNull);
expect(frame.column, isNull);
});
+ });
+ group('.parseV8', () {
test('returns an UnparsedFrame for malformed frames', () {
expectIsUnparsed((text) => new Frame.parseV8(text), '');
expectIsUnparsed((text) => new Frame.parseV8(text), '#1');
@@ -80,9 +80,7 @@ void main() {
expectIsUnparsed((text) => new Frame.parseV8(text),
'Foo (dart:async/future.dart:10:15)');
});
- });
- group('.parseV8', () {
test('parses a stack frame correctly', () {
var frame = new Frame.parseV8(" at VW.call\$0 "
"(http://pub.dartlang.org/stuff.dart.js:560:28)");
@@ -114,8 +112,8 @@ void main() {
test('parses a stack frame with a Windows UNC path correctly', () {
var frame = new Frame.parseV8(" at VW.call\$0 "
r"(\\mount\path\to\stuff.dart.js:560:28)");
- expect(frame.uri,
- equals(Uri.parse("file://mount/path/to/stuff.dart.js")));
+ expect(
+ frame.uri, equals(Uri.parse("file://mount/path/to/stuff.dart.js")));
expect(frame.line, equals(560));
expect(frame.column, equals(28));
expect(frame.member, equals('VW.call\$0'));
@@ -150,8 +148,7 @@ void main() {
});
test('parses a native stack frame correctly', () {
- var frame = new Frame.parseV8(
- " at Object.stringify (native)");
+ var frame = new Frame.parseV8(" at Object.stringify (native)");
expect(frame.uri, Uri.parse('native'));
expect(frame.line, isNull);
expect(frame.column, isNull);
@@ -215,8 +212,8 @@ void main() {
new Frame.parseV8(' at $member (foo:0:0)').member;
expect(parsedMember('Foo.<anonymous>'), equals('Foo.<fn>'));
- expect(parsedMember('<anonymous>.<anonymous>.bar'),
- equals('<fn>.<fn>.bar'));
+ expect(
+ parsedMember('<anonymous>.<anonymous>.bar'), equals('<fn>.<fn>.bar'));
});
test('returns an UnparsedFrame for malformed frames', () {
@@ -229,12 +226,12 @@ void main() {
' at (dart:async/future.dart:10:15)');
expectIsUnparsed((text) => new Frame.parseV8(text),
'Foo (dart:async/future.dart:10:15)');
- expectIsUnparsed((text) => new Frame.parseV8(text),
- ' at dart:async/future.dart');
+ expectIsUnparsed(
+ (text) => new Frame.parseV8(text), ' at dart:async/future.dart');
expectIsUnparsed((text) => new Frame.parseV8(text),
' at dart:async/future.dart:10');
- expectIsUnparsed((text) => new Frame.parseV8(text),
- 'dart:async/future.dart:10:15');
+ expectIsUnparsed(
+ (text) => new Frame.parseV8(text), 'dart:async/future.dart:10:15');
});
});
@@ -250,8 +247,8 @@ void main() {
});
test('parses a stack frame with an absolute POSIX path correctly', () {
- var frame = new Frame.parseFirefox(
- ".VW.call\$0@/path/to/stuff.dart.js:560");
+ var frame =
+ new Frame.parseFirefox(".VW.call\$0@/path/to/stuff.dart.js:560");
expect(frame.uri, equals(Uri.parse("file:///path/to/stuff.dart.js")));
expect(frame.line, equals(560));
expect(frame.column, isNull);
@@ -259,8 +256,8 @@ void main() {
});
test('parses a stack frame with an absolute Windows path correctly', () {
- var frame = new Frame.parseFirefox(
- r".VW.call$0@C:\path\to\stuff.dart.js:560");
+ var frame =
+ new Frame.parseFirefox(r".VW.call$0@C:\path\to\stuff.dart.js:560");
expect(frame.uri, equals(Uri.parse("file:///C:/path/to/stuff.dart.js")));
expect(frame.line, equals(560));
expect(frame.column, isNull);
@@ -270,16 +267,16 @@ void main() {
test('parses a stack frame with a Windows UNC path correctly', () {
var frame = new Frame.parseFirefox(
r".VW.call$0@\\mount\path\to\stuff.dart.js:560");
- expect(frame.uri,
- equals(Uri.parse("file://mount/path/to/stuff.dart.js")));
+ expect(
+ frame.uri, equals(Uri.parse("file://mount/path/to/stuff.dart.js")));
expect(frame.line, equals(560));
expect(frame.column, isNull);
expect(frame.member, equals('VW.call\$0'));
});
test('parses a stack frame with a relative POSIX path correctly', () {
- var frame = new Frame.parseFirefox(
- ".VW.call\$0@path/to/stuff.dart.js:560");
+ var frame =
+ new Frame.parseFirefox(".VW.call\$0@path/to/stuff.dart.js:560");
expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js")));
expect(frame.line, equals(560));
expect(frame.column, isNull);
@@ -287,8 +284,8 @@ void main() {
});
test('parses a stack frame with a relative Windows path correctly', () {
- var frame = new Frame.parseFirefox(
- r".VW.call$0@path\to\stuff.dart.js:560");
+ var frame =
+ new Frame.parseFirefox(r".VW.call$0@path\to\stuff.dart.js:560");
expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js")));
expect(frame.line, equals(560));
expect(frame.column, isNull);
@@ -296,8 +293,8 @@ void main() {
});
test('parses a simple anonymous stack frame correctly', () {
- var frame = new Frame.parseFirefox(
- "@http://pub.dartlang.org/stuff.dart.js:560");
+ var frame =
+ new Frame.parseFirefox("@http://pub.dartlang.org/stuff.dart.js:560");
expect(frame.uri,
equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
expect(frame.line, equals(560));
@@ -352,8 +349,7 @@ void main() {
});
test('parses a nested anonymous stack frame with parameters correctly', () {
- var frame = new Frame.parseFirefox(
- '.foo(12, "@)()/<")/.fn<@'
+ var frame = new Frame.parseFirefox('.foo(12, "@)()/<")/.fn<@'
'http://pub.dartlang.org/stuff.dart.js:560');
expect(frame.uri,
equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
@@ -362,11 +358,12 @@ void main() {
expect(frame.member, equals("foo.<fn>"));
});
- test('parses a deeply-nested anonymous stack frame with parameters '
+ test(
+ 'parses a deeply-nested anonymous stack frame with parameters '
'correctly', () {
- var frame = new Frame.parseFirefox(
- '.convertDartClosureToJS/\$function</<@'
- 'http://pub.dartlang.org/stuff.dart.js:560');
+ var frame =
+ new Frame.parseFirefox('.convertDartClosureToJS/\$function</<@'
+ 'http://pub.dartlang.org/stuff.dart.js:560');
expect(frame.uri,
equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
expect(frame.line, equals(560));
@@ -381,8 +378,8 @@ void main() {
'.foo@dart:async/future.dart');
expectIsUnparsed((text) => new Frame.parseFirefox(text),
'.foo(@dart:async/future.dart:10');
- expectIsUnparsed((text) => new Frame.parseFirefox(text),
- '@dart:async/future.dart');
+ expectIsUnparsed(
+ (text) => new Frame.parseFirefox(text), '@dart:async/future.dart');
});
test('parses a simple stack frame correctly', () {
@@ -395,8 +392,8 @@ void main() {
});
test('parses an anonymous stack frame correctly', () {
- var frame = new Frame.parseFirefox(
- "http://dartlang.org/foo/bar.dart:10:11");
+ var frame =
+ new Frame.parseFirefox("http://dartlang.org/foo/bar.dart:10:11");
expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
expect(frame.line, equals(10));
expect(frame.column, equals(11));
@@ -450,7 +447,7 @@ void main() {
expect(frame.member, equals('Foo.<fn>.bar'));
});
- test('parses a stack frame with no line correctly', () {
+ test('parses a stack frame with no column correctly', () {
var frame = new Frame.parseFriendly(
"http://dartlang.org/foo/bar.dart 10 Foo.<fn>.bar");
expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
@@ -461,8 +458,8 @@ void main() {
test('parses a stack frame with a relative path correctly', () {
var frame = new Frame.parseFriendly("foo/bar.dart 10:11 Foo.<fn>.bar");
- expect(frame.uri, equals(
- path.toUri(path.absolute(path.join('foo', 'bar.dart')))));
+ expect(frame.uri,
+ equals(path.toUri(path.absolute(path.join('foo', 'bar.dart')))));
expect(frame.line, equals(10));
expect(frame.column, equals(11));
expect(frame.member, equals('Foo.<fn>.bar'));
@@ -471,14 +468,51 @@ void main() {
test('returns an UnparsedFrame for malformed frames', () {
expectIsUnparsed((text) => new Frame.parseFriendly(text), '');
expectIsUnparsed((text) => new Frame.parseFriendly(text), 'foo/bar.dart');
- expectIsUnparsed((text) => new Frame.parseFriendly(text),
- 'foo/bar.dart 10:11');
+ expectIsUnparsed(
+ (text) => new Frame.parseFriendly(text), 'foo/bar.dart 10:11');
+ });
+
+ test('parses a data url stack frame with no line or column correctly', () {
+ var frame = new Frame.parseFriendly("data:... main");
+ expect(frame.uri.scheme, equals('data'));
+ expect(frame.line, isNull);
+ expect(frame.column, isNull);
+ expect(frame.member, equals('main'));
+ });
+
+ test('parses a data url stack frame correctly', () {
+ var frame = new Frame.parseFriendly("data:... 10:11 main");
+ expect(frame.uri.scheme, equals('data'));
+ expect(frame.line, equals(10));
+ expect(frame.column, equals(11));
+ expect(frame.member, equals('main'));
+ });
+
+ test('parses a stack frame with spaces in the member name correctly', () {
+ var frame = new Frame.parseFriendly(
+ "foo/bar.dart 10:11 (anonymous function).dart.fn");
+ expect(frame.uri,
+ equals(path.toUri(path.absolute(path.join('foo', 'bar.dart')))));
+ expect(frame.line, equals(10));
+ expect(frame.column, equals(11));
+ expect(frame.member, equals('(anonymous function).dart.fn'));
+ });
+
+ test(
+ 'parses a stack frame with spaces in the member name and no line or '
+ 'column correctly', () {
+ var frame = new Frame.parseFriendly(
+ "http://dartlang.org/foo/bar.dart (anonymous function).dart.fn");
+ expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
+ expect(frame.line, isNull);
+ expect(frame.column, isNull);
+ expect(frame.member, equals('(anonymous function).dart.fn'));
});
});
test('only considers dart URIs to be core', () {
bool isCore(String library) =>
- new Frame.parseVM('#0 Foo ($library:0:0)').isCore;
+ new Frame.parseVM('#0 Foo ($library:0:0)').isCore;
expect(isCore('dart:core'), isTrue);
expect(isCore('dart:async'), isTrue);
@@ -494,8 +528,10 @@ void main() {
test('returns the URI string for non-file URIs', () {
expect(new Frame.parseVM('#0 Foo (dart:async/future.dart:0:0)').library,
equals('dart:async/future.dart'));
- expect(new Frame.parseVM('#0 Foo '
- '(http://dartlang.org/stuff/thing.dart:0:0)').library,
+ expect(
+ new Frame.parseVM('#0 Foo '
+ '(http://dartlang.org/stuff/thing.dart:0:0)')
+ .library,
equals('http://dartlang.org/stuff/thing.dart'));
});
@@ -512,10 +548,13 @@ void main() {
});
group('.location', () {
- test('returns the library and line/column numbers for non-core '
+ test(
+ 'returns the library and line/column numbers for non-core '
'libraries', () {
- expect(new Frame.parseVM('#0 Foo '
- '(http://dartlang.org/thing.dart:5:10)').location,
+ expect(
+ new Frame.parseVM('#0 Foo '
+ '(http://dartlang.org/thing.dart:5:10)')
+ .location,
equals('http://dartlang.org/thing.dart 5:10'));
expect(new Frame.parseVM('#0 Foo (foo/bar.dart:1:2)').location,
equals('${path.join('foo', 'bar.dart')} 1:2'));
@@ -526,8 +565,10 @@ void main() {
test('returns null for non-package URIs', () {
expect(new Frame.parseVM('#0 Foo (dart:async/future.dart:0:0)').package,
isNull);
- expect(new Frame.parseVM('#0 Foo '
- '(http://dartlang.org/stuff/thing.dart:0:0)').package,
+ expect(
+ new Frame.parseVM('#0 Foo '
+ '(http://dartlang.org/stuff/thing.dart:0:0)')
+ .package,
isNull);
});
@@ -540,16 +581,20 @@ void main() {
});
group('.toString()', () {
- test('returns the library and line/column numbers for non-core '
+ test(
+ 'returns the library and line/column numbers for non-core '
'libraries', () {
- expect(new Frame.parseVM('#0 Foo (http://dartlang.org/thing.dart:5:10)')
+ expect(
+ new Frame.parseVM('#0 Foo (http://dartlang.org/thing.dart:5:10)')
.toString(),
equals('http://dartlang.org/thing.dart 5:10 in Foo'));
});
test('converts "<anonymous closure>" to "<fn>"', () {
- expect(new Frame.parseVM('#0 Foo.<anonymous closure> '
- '(dart:core/uri.dart:5:10)').toString(),
+ expect(
+ new Frame.parseVM('#0 Foo.<anonymous closure> '
+ '(dart:core/uri.dart:5:10)')
+ .toString(),
equals('dart:core/uri.dart 5:10 in Foo.<fn>'));
});
« no previous file with comments | « packages/stack_trace/test/chain/vm_test.dart ('k') | packages/stack_trace/test/trace_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698