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

Side by Side Diff: runtime/observatory/tests/service/command_test.dart

Issue 2552783003: Better reporting of ambiguous and "not found" commands in Obs debugger. (Closed)
Patch Set: Better reporting of ambiguous and "not found" commands in Obs debugger. Created 3 years, 10 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
« no previous file with comments | « runtime/observatory/lib/src/elements/sample_buffer_control.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 7
8 import 'package:observatory/cli.dart'; 8 import 'package:observatory/cli.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 })); 178 }));
179 })); 179 }));
180 } 180 }
181 181
182 void testCommandRunNotFound() { 182 void testCommandRunNotFound() {
183 // Run a simple command. 183 // Run a simple command.
184 StringBuffer out = new StringBuffer(); 184 StringBuffer out = new StringBuffer();
185 RootCommand cmd = new RootCommand([new TestCommand(out, 'alpha', [])]); 185 RootCommand cmd = new RootCommand([new TestCommand(out, 'alpha', [])]);
186 186
187 cmd.runCommand('goose').catchError(expectAsync((e) { 187 cmd.runCommand('goose').catchError(expectAsync((e) {
188 expect(e, equals('No such command')); 188 expect(e.toString(), equals("No such command: 'goose'"));
189 })); 189 }));
190 } 190 }
191 191
192 void testCommandRunAmbiguous() { 192 void testCommandRunAmbiguous() {
193 // Run a simple command. 193 // Run a simple command.
194 StringBuffer out = new StringBuffer(); 194 StringBuffer out = new StringBuffer();
195 RootCommand cmd = new RootCommand([new TestCommand(out, 'alpha', []), 195 RootCommand cmd = new RootCommand([new TestCommand(out, 'alpha', []),
196 new TestCommand(out, 'ankle', [])]); 196 new TestCommand(out, 'ankle', [])]);
197 197
198 cmd.runCommand('a 55').catchError(expectAsync((e) { 198 cmd.runCommand('a 55').catchError(expectAsync((e) {
199 expect(e, equals('Ambiguous command')); 199 expect(e.toString(),
200 equals("Command 'a 55' is ambiguous: [alpha, ankle]"));
200 out.clear(); 201 out.clear();
201 cmd.runCommand('ankl 55').then(expectAsync((_) { 202 cmd.runCommand('ankl 55').then(expectAsync((_) {
202 expect(out.toString(), equals('executing ankle([55])\n')); 203 expect(out.toString(), equals('executing ankle([55])\n'));
203 })); 204 }));
204 })); 205 }));
205 } 206 }
206 207
207 void testCommandRunAlias() { 208 void testCommandRunAlias() {
208 // Run a simple command. 209 // Run a simple command.
209 StringBuffer out = new StringBuffer(); 210 StringBuffer out = new StringBuffer();
210 var aliasCmd = new TestCommand(out, 'alpha', []); 211 var aliasCmd = new TestCommand(out, 'alpha', []);
211 aliasCmd.alias = 'a'; 212 aliasCmd.alias = 'a';
212 RootCommand cmd = new RootCommand([aliasCmd, 213 RootCommand cmd = new RootCommand([aliasCmd,
213 new TestCommand(out, 'ankle', [])]); 214 new TestCommand(out, 'ankle', [])]);
214 215
215 cmd.runCommand('a 55').then(expectAsync((_) { 216 cmd.runCommand('a 55').then(expectAsync((_) {
216 expect(out.toString(), equals('executing alpha([55])\n')); 217 expect(out.toString(), equals('executing alpha([55])\n'));
217 })); 218 }));
218 } 219 }
219 220
220 main() { 221 main() {
221 test('command completion test suite', testCommandComplete); 222 test('command completion test suite', testCommandComplete);
222 test('run a simple command', testCommandRunSimple); 223 test('run a simple command', testCommandRunSimple);
223 test('run a subcommand', testCommandRunSubcommand); 224 test('run a subcommand', testCommandRunSubcommand);
224 test('run a command which is not found', testCommandRunNotFound); 225 test('run a command which is not found', testCommandRunNotFound);
225 test('run a command which is ambiguous', testCommandRunAmbiguous); 226 test('run a command which is ambiguous', testCommandRunAmbiguous);
226 test('run a command using an alias', testCommandRunAlias); 227 test('run a command using an alias', testCommandRunAlias);
227 } 228 }
228 229
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/sample_buffer_control.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698