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

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

Issue 18029023: Add a couple functions to package:stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 6 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 | « pkg/stack_trace/lib/src/vm_trace.dart ('k') | pkg/stack_trace/test/trace_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/stack_trace/test/frame_test.dart
diff --git a/pkg/stack_trace/test/frame_test.dart b/pkg/stack_trace/test/frame_test.dart
index 2ab310c3d85831ced2f00477dbf458b40bdb9a2b..f38278d647002ed032668b792fafba57ed46f6e4 100644
--- a/pkg/stack_trace/test/frame_test.dart
+++ b/pkg/stack_trace/test/frame_test.dart
@@ -185,6 +185,43 @@ void main() {
});
});
+ group('.parseFriendly', () {
+ test('parses a simple stack frame correctly', () {
+ var frame = new Frame.parseFriendly(
+ "http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar");
+ expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
+ expect(frame.line, equals(10));
+ expect(frame.column, equals(11));
+ expect(frame.member, equals('Foo.<fn>.bar'));
+ });
+
+ test('parses a stack frame with no line or column correctly', () {
+ var frame = new Frame.parseFriendly(
+ "http://dartlang.org/foo/bar.dart Foo.<fn>.bar");
+ expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
+ expect(frame.line, isNull);
+ expect(frame.column, isNull);
+ expect(frame.member, equals('Foo.<fn>.bar'));
+ });
+
+ 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.line, equals(10));
+ expect(frame.column, equals(11));
+ expect(frame.member, equals('Foo.<fn>.bar'));
+ });
+
+ test('throws a FormatException for malformed frames', () {
+ expect(() => new Frame.parseFriendly(''), throwsFormatException);
+ expect(() => new Frame.parseFriendly('foo/bar.dart'),
+ throwsFormatException);
+ expect(() => new Frame.parseFriendly('foo/bar.dart 10:11'),
+ throwsFormatException);
+ });
+ });
+
test('only considers dart URIs to be core', () {
bool isCore(String library) =>
new Frame.parseVM('#0 Foo ($library:0:0)').isCore;
« no previous file with comments | « pkg/stack_trace/lib/src/vm_trace.dart ('k') | pkg/stack_trace/test/trace_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698