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

Side by Side Diff: runtime/observatory/test/command_test.dart

Issue 993613002: Implement 'print', 'up', 'down', and 'frame' commands in the Observatory debugger. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:observatory/cli.dart'; 7 import 'package:observatory/cli.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 class TestCommand extends Command { 10 class TestCommand extends Command {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // Locals + subcommands, show all. 118 // Locals + subcommands, show all.
119 cmd.completeCommand('count ').then((result) { 119 cmd.completeCommand('count ').then((result) {
120 expect(result, equals(['count chocula ', 120 expect(result, equals(['count chocula ',
121 'count one ', 121 'count one ',
122 'count two ', 122 'count two ',
123 'count three '])); 123 'count three ']));
124 }); 124 });
125 125
126 // Locals + subcommands, single local match. 126 // Locals + subcommands, single local match.
127 cmd.completeCommand('count th ').then((result) { 127 cmd.completeCommand('count th').then((result) {
128 expect(result, equals(['count three '])); 128 expect(result, equals(['count three ']));
129 }); 129 });
130 130
131 // Locals + subcommands, ambiguous local match. 131 // Locals + subcommands, ambiguous local match.
132 cmd.completeCommand('count t').then((result) { 132 cmd.completeCommand('count t').then((result) {
133 expect(result, equals(['count two ', 'count three '])); 133 expect(result, equals(['count two ', 'count three ']));
134 }); 134 });
135 135
136 // Locals + subcommands, single command match. 136 // Locals + subcommands, single command match.
137 cmd.completeCommand('co choc').then((result) { 137 cmd.completeCommand('co choc').then((result) {
138 expect(result, equals(['co chocula '])); 138 expect(result, equals(['co chocula ']));
139 }); 139 });
140 140
141 // We gobble spare spaces, even in the prefix. 141 // We gobble spare spaces in the prefix but not elsewhere.
142 cmd.completeCommand(' game chec').then((result) { 142 cmd.completeCommand(' game chec').then((result) {
143 expect(result, equals(['game checkers '])); 143 expect(result, equals(['game checkers ']));
144 }); 144 });
145 } 145 }
146 146
147 void testCommandRunSimple() { 147 void testCommandRunSimple() {
148 // Run a simple command. 148 // Run a simple command.
149 StringBuffer out = new StringBuffer(); 149 StringBuffer out = new StringBuffer();
150 RootCommand cmd = new RootCommand([new TestCommand(out, 'alpha', [])]); 150 RootCommand cmd = new RootCommand([new TestCommand(out, 'alpha', [])]);
151 151
152 // Full name dispatch works. Argument passing works. 152 // Full name dispatch works. Argument passing works.
153 cmd.runCommand('alpha dog').then(expectAsync((_) { 153 cmd.runCommand('alpha dog').then(expectAsync((_) {
154 expect(out.toString(), contains('executing alpha([dog])\n')); 154 expect(out.toString(), contains('executing alpha([dog])\n'));
155 out.clear(); 155 out.clear();
156 // Substring dispatch works. 156 // Substring dispatch works.
157 cmd.runCommand('al cat mouse').then(expectAsync((_) { 157 cmd.runCommand('al cat mouse').then(expectAsync((_) {
158 expect(out.toString(), contains('executing alpha([cat, mouse])\n')); 158 expect(out.toString(), contains('executing alpha([cat , mouse])\n'));
159 })); 159 }));
160 })); 160 }));
161 } 161 }
162 162
163 void testCommandRunSubcommand() { 163 void testCommandRunSubcommand() {
164 // Run a simple command. 164 // Run a simple command.
165 StringBuffer out = new StringBuffer(); 165 StringBuffer out = new StringBuffer();
166 RootCommand cmd = 166 RootCommand cmd =
167 new RootCommand([ 167 new RootCommand([
168 new TestCommand(out, 'alpha', [ 168 new TestCommand(out, 'alpha', [
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 main() { 219 main() {
220 test('command completion test suite', testCommandComplete); 220 test('command completion test suite', testCommandComplete);
221 test('run a simple command', testCommandRunSimple); 221 test('run a simple command', testCommandRunSimple);
222 test('run a subcommand', testCommandRunSubcommand); 222 test('run a subcommand', testCommandRunSubcommand);
223 test('run a command which is not found', testCommandRunNotFound); 223 test('run a command which is not found', testCommandRunNotFound);
224 test('run a command which is ambiguous', testCommandRunAmbiguous); 224 test('run a command which is ambiguous', testCommandRunAmbiguous);
225 test('run a command using an alias', testCommandRunAlias); 225 test('run a command using an alias', testCommandRunAlias);
226 } 226 }
227 227
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/observatory/test/debugging_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698