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

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

Issue 1393523002: Support tab completion of line:col in the debugger. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: edits Created 5 years, 2 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
Index: runtime/observatory/tests/service/debugger_location_test.dart
diff --git a/runtime/observatory/tests/service/debugger_location_test.dart b/runtime/observatory/tests/service/debugger_location_test.dart
index 33ca476ee7f2f1ac2441b7cef084b41bfe9a963d..7825ae6b1f56a1d46090874eaa7a20ea92d3db5d 100644
--- a/runtime/observatory/tests/service/debugger_location_test.dart
+++ b/runtime/observatory/tests/service/debugger_location_test.dart
@@ -55,209 +55,233 @@ var tests = [
hasStoppedAtBreakpoint,
// Parse '' => current position
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, '').then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- expect(loc.toString(), equals('debugger_location_test.dart:17:5'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc = await DebuggerLocation.parse(debugger, '');
+ expect(loc.valid, isTrue);
+ expect(loc.toString(), equals('debugger_location_test.dart:17:5'));
},
// Parse line
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, '18').then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- expect(loc.toString(), equals('debugger_location_test.dart:18'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc = await DebuggerLocation.parse(debugger, '18');
+ expect(loc.valid, isTrue);
+ expect(loc.toString(), equals('debugger_location_test.dart:18'));
},
// Parse line + col
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, '16:11').then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- expect(loc.toString(), equals('debugger_location_test.dart:16:11'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc = await DebuggerLocation.parse(debugger, '16:11');
+ expect(loc.valid, isTrue);
+ expect(loc.toString(), equals('debugger_location_test.dart:16:11'));
},
// Parse script + line
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'unittest.dart:15')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- expect(loc.toString(), equals('unittest.dart:15'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc = await DebuggerLocation.parse(debugger, 'unittest.dart:15');
+ expect(loc.valid, isTrue);
+ expect(loc.toString(), equals('unittest.dart:15'));
},
// Parse script + line + col
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'unittest.dart:15:10')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- expect(loc.toString(), equals('unittest.dart:15:10'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc = await DebuggerLocation.parse(debugger, 'unittest.dart:15:10');
+ expect(loc.valid, isTrue);
+ expect(loc.toString(), equals('unittest.dart:15:10'));
},
// Parse bad script
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'bad.dart:15')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isFalse);
- expect(loc.toString(), equals(
- 'invalid source location (Script \'bad.dart\' not found)'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc = await DebuggerLocation.parse(debugger, 'bad.dart:15');
+ expect(loc.valid, isFalse);
+ expect(loc.toString(), equals(
+ 'invalid source location (Script \'bad.dart\' not found)'));
},
// Parse function
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'testFunction')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- expect(loc.toString(), equals('testFunction'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc = await DebuggerLocation.parse(debugger, 'testFunction');
+ expect(loc.valid, isTrue);
+ expect(loc.toString(), equals('testFunction'));
},
// Parse bad function
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'doesNotReallyExit')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isFalse);
- expect(loc.toString(), equals(
- 'invalid source location (Function \'doesNotReallyExit\' not found)'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc = await DebuggerLocation.parse(debugger, 'doesNotReallyExist');
+ expect(loc.valid, isFalse);
+ expect(loc.toString(), equals(
+ 'invalid source location (Function \'doesNotReallyExist\' not found)'));
},
// Parse constructor
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- // TODO(turnidge): Printing a constructor currently adds
- // another class qualifier at the front. Do we want to change
- // this to be more consistent?
- expect(loc.toString(), equals(
- 'DebuggerLocationTestFoo.DebuggerLocationTestFoo'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc = await DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo');
+ expect(loc.valid, isTrue);
+ // TODO(turnidge): Printing a constructor currently adds
+ // another class qualifier at the front. Do we want to change
+ // this to be more consistent?
+ expect(loc.toString(), equals(
+ 'DebuggerLocationTestFoo.DebuggerLocationTestFoo'));
},
// Parse named constructor
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo.named')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- // TODO(turnidge): Printing a constructor currently adds
- // another class qualifier at the front. Do we want to change
- // this to be more consistent?
- expect(loc.toString(), equals(
- 'DebuggerLocationTestFoo.DebuggerLocationTestFoo.named'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc =
+ await DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo.named');
+ expect(loc.valid, isTrue);
+ // TODO(turnidge): Printing a constructor currently adds
+ // another class qualifier at the front. Do we want to change
+ // this to be more consistent?
+ expect(loc.toString(), equals(
+ 'DebuggerLocationTestFoo.DebuggerLocationTestFoo.named'));
},
// Parse method
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo.method')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- expect(loc.toString(), equals('DebuggerLocationTestFoo.method'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc =
+ await DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo.method');
+ expect(loc.valid, isTrue);
+ expect(loc.toString(), equals('DebuggerLocationTestFoo.method'));
},
// Parse method
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo.field=')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isTrue);
- expect(loc.toString(), equals('DebuggerLocationTestFoo.field='));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc =
+ await DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo.field=');
+ expect(loc.valid, isTrue);
+ expect(loc.toString(), equals('DebuggerLocationTestFoo.field='));
},
// Parse bad method
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo.missing')
- .then((DebuggerLocation loc) {
- expect(loc.valid, isFalse);
- expect(loc.toString(), equals(
- 'invalid source location '
- '(Function \'DebuggerLocationTestFoo.missing\' not found)'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var loc =
+ await DebuggerLocation.parse(debugger, 'DebuggerLocationTestFoo.missing');
+ expect(loc.valid, isFalse);
+ expect(loc.toString(), equals(
+ 'invalid source location '
+ '(Function \'DebuggerLocationTestFoo.missing\' not found)'));
},
// Complete function + script
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.complete(debugger, 'debugger_loc')
- .then((List<String> completions) {
- expect(completions.toString(), equals(
- '[debugger_location_dummy_function, '
- 'debugger_location.dart:, debugger_location_test.dart:]'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var completions = await DebuggerLocation.complete(debugger, 'debugger_loc');
+ expect(completions.toString(), equals(
+ '[debugger_location_dummy_function,'
+ ' debugger_location.dart:,'
+ ' debugger_location_test.dart:]'));
},
// Complete class
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.complete(debugger, 'DebuggerLocationTe')
- .then((List<String> completions) {
- expect(completions.toString(), equals(
- '[DebuggerLocationTestBar, DebuggerLocationTestFoo]'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var completions =
+ await DebuggerLocation.complete(debugger, 'DebuggerLocationTe');
+ expect(completions.toString(), equals(
+ '[DebuggerLocationTestBar,'
+ ' DebuggerLocationTestFoo]'));
},
// No completions: unqualified name
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.complete(debugger, 'debugger_locXYZZY')
- .then((List<String> completions) {
- expect(completions.toString(), equals('[]'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var completions =
+ await DebuggerLocation.complete(debugger, 'debugger_locXYZZY');
+ expect(completions.toString(), equals('[]'));
},
// Complete method
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.complete(debugger, 'DebuggerLocationTestFoo.m')
- .then((List<String> completions) {
- expect(completions.toString(), equals(
- '[DebuggerLocationTestFoo.madness, DebuggerLocationTestFoo.method]'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var completions =
+ await DebuggerLocation.complete(debugger, 'DebuggerLocationTestFoo.m');
+ expect(completions.toString(), equals(
+ '[DebuggerLocationTestFoo.madness,'
+ ' DebuggerLocationTestFoo.method]'));
},
// No completions: qualified name
-(Isolate isolate) {
- return initDebugger(isolate).then((debugger) {
- return DebuggerLocation.complete(debugger, 'DebuggerLocationTestFoo.q')
- .then((List<String> completions) {
- expect(completions.toString(), equals('[]'));
- });
- });
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var completions =
+ await DebuggerLocation.complete(debugger, 'DebuggerLocationTestFoo.q');
+ expect(completions.toString(), equals('[]'));
+},
+
+// Complete script
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var completions =
+ await DebuggerLocation.complete(debugger, 'debugger_location_te');
+ expect(completions.toString(), equals(
+ '[debugger_location_test.dart:]'));
+},
+
+// Complete script:line
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var completions =
+ await DebuggerLocation.complete(debugger,
+ 'debugger_location_test.dart:11');
+ expect(completions.toString(), equals(
+ '[debugger_location_test.dart:11 ,'
+ ' debugger_location_test.dart:11:,'
+ ' debugger_location_test.dart:110 ,'
+ ' debugger_location_test.dart:110:,'
+ ' debugger_location_test.dart:111 ,'
+ ' debugger_location_test.dart:111:,'
+ ' debugger_location_test.dart:112 ,'
+ ' debugger_location_test.dart:112:,'
+ ' debugger_location_test.dart:115 ,'
+ ' debugger_location_test.dart:115:,'
+ ' debugger_location_test.dart:116 ,'
+ ' debugger_location_test.dart:116:,'
+ ' debugger_location_test.dart:117 ,'
+ ' debugger_location_test.dart:117:,'
+ ' debugger_location_test.dart:118 ,'
+ ' debugger_location_test.dart:118:,'
+ ' debugger_location_test.dart:119 ,'
+ ' debugger_location_test.dart:119:]'));
+},
+
+// Complete script:line:col
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var completions =
+ await DebuggerLocation.complete(debugger,
+ 'debugger_location_test.dart:11:2');
+ expect(completions.toString(), equals(
+ '[debugger_location_test.dart:11:2 ,'
+ ' debugger_location_test.dart:11:20 ,'
+ ' debugger_location_test.dart:11:21 ,'
+ ' debugger_location_test.dart:11:22 ,'
+ ' debugger_location_test.dart:11:23 ,'
+ ' debugger_location_test.dart:11:24 ]'));
+},
+
+// Complete without the script name.
+(Isolate isolate) async {
+ var debugger = await initDebugger(isolate);
+ var completions = await DebuggerLocation.complete(debugger, '11:2');
+ expect(completions.toString(), equals(
+ '[debugger_location_test.dart:11:2 ,'
+ ' debugger_location_test.dart:11:20 ,'
+ ' debugger_location_test.dart:11:21 ,'
+ ' debugger_location_test.dart:11:22 ,'
+ ' debugger_location_test.dart:11:23 ,'
+ ' debugger_location_test.dart:11:24 ]'));
},
];

Powered by Google App Engine
This is Rietveld 408576698