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

Unified Diff: runtime/observatory/tests/service/positive_token_pos_test.dart

Issue 2294883004: Don't return negative token positions in stack traces. (Closed)
Patch Set: Created 4 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 | « no previous file | runtime/observatory/tests/service/service_test_common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/positive_token_pos_test.dart
diff --git a/runtime/observatory/tests/service/positive_token_pos_test.dart b/runtime/observatory/tests/service/positive_token_pos_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..eb46496847680abe20fe018f36618adf9e545a33
--- /dev/null
+++ b/runtime/observatory/tests/service/positive_token_pos_test.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+// VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug
+
+import 'dart:developer';
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+import 'service_test_common.dart';
+import 'test_helper.dart';
+
+helper() async { // Line 12, Col 16 is the open brace.
+}
+
+testMain() {
+ debugger();
+ helper(); // Line 17, Col 3 is the position of the function call.
+}
+
+var tests = [
+ hasStoppedAtBreakpoint,
+ stoppedAtLine(17),
+ stepInto,
+
+ (Isolate isolate) async {
+ ServiceMap stack = await isolate.getStack();
+ expect(stack['frames'].length, greaterThan(3));
+
+ var frame = stack['frames'][0];
+ expect(frame.function.name, equals('Completer.sync'));
+ expect(await frame.location.getLine(), greaterThan(0));
+ expect(await frame.location.getColumn(), greaterThan(0));
+
+ // We used to return a negative token position for this frame.
+ // See issue #27128.
+ frame = stack['frames'][1];
+ expect(frame.function.name, equals('helper'));
+ expect(await frame.location.getLine(), equals(12));
+ expect(await frame.location.getColumn(), equals(16));
+
+ frame = stack['frames'][2];
+ expect(frame.function.name, equals('testMain'));
+ expect(await frame.location.getLine(), equals(17));
+ expect(await frame.location.getColumn(), equals(3));
+ }
+];
+
+main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain);
« no previous file with comments | « no previous file | runtime/observatory/tests/service/service_test_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698