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

Unified Diff: test/vm_test.dart

Issue 1653603002: pkg/stack_trace: Use StackTrace.current (Closed) Base URL: https://github.com/dart-lang/stack_trace.git@master
Patch Set: nits Created 4 years, 11 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/trace_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/vm_test.dart
diff --git a/test/vm_test.dart b/test/vm_test.dart
index 947f14bd7b53456114cadbdd6690b38885a3d8c5..f0967b51024138a3fafc9ffb698b837fbb38e431 100644
--- a/test/vm_test.dart
+++ b/test/vm_test.dart
@@ -12,22 +12,6 @@ import 'package:path/path.dart' as path;
import 'package:stack_trace/stack_trace.dart';
import 'package:test/test.dart';
-String getStackTraceString() {
- try {
- throw '';
- } catch (_, stackTrace) {
- return stackTrace.toString();
- }
-}
-
-StackTrace getStackTraceObject() {
- try {
- throw '';
- } catch (_, stackTrace) {
- return stackTrace;
- }
-}
-
Frame getCaller([int level]) {
if (level == null) return new Frame.caller();
return new Frame.caller(level);
@@ -42,7 +26,7 @@ Trace nestedGetCurrentTrace(int level) => getCurrentTrace(level);
void main() {
group('Trace', () {
test('.parse parses a real stack trace correctly', () {
- var string = getStackTraceString();
+ var string = StackTrace.current.toString();
var trace = new Trace.parse(string);
expect(path.url.basename(trace.frames.first.uri.path),
equals('vm_test.dart'));
@@ -50,7 +34,7 @@ void main() {
});
test('converts from a native stack trace correctly', () {
- var trace = new Trace.from(getStackTraceObject());
+ var trace = new Trace.from(StackTrace.current);
expect(path.url.basename(trace.frames.first.uri.path),
equals('vm_test.dart'));
expect(trace.frames.first.member, equals('getStackTraceObject'));
« no previous file with comments | « test/trace_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698