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

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

Issue 984683002: Allow command aliases in 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
« no previous file with comments | « runtime/observatory/lib/src/elements/debugger.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 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 cmd.runCommand('a 55').catchError(expectAsync((e) { 197 cmd.runCommand('a 55').catchError(expectAsync((e) {
198 expect(e, equals('ambiguous')); 198 expect(e, equals('ambiguous'));
199 out.clear(); 199 out.clear();
200 cmd.runCommand('ankl 55').then(expectAsync((_) { 200 cmd.runCommand('ankl 55').then(expectAsync((_) {
201 expect(out.toString(), equals('executing ankle([55])\n')); 201 expect(out.toString(), equals('executing ankle([55])\n'));
202 })); 202 }));
203 })); 203 }));
204 } 204 }
205 205
206 void testCommandRunAlias() {
207 // Run a simple command.
208 StringBuffer out = new StringBuffer();
209 var aliasCmd = new TestCommand(out, 'alpha', []);
210 aliasCmd.alias = 'a';
211 RootCommand cmd = new RootCommand([aliasCmd,
212 new TestCommand(out, 'ankle', [])]);
213
214 cmd.runCommand('a 55').then(expectAsync((_) {
215 expect(out.toString(), equals('executing alpha([55])\n'));
216 }));
217 }
218
206 main() { 219 main() {
207 test('command completion test suite', testCommandComplete); 220 test('command completion test suite', testCommandComplete);
208 test('run a simple command', testCommandRunSimple); 221 test('run a simple command', testCommandRunSimple);
209 test('run a subcommand', testCommandRunSubcommand); 222 test('run a subcommand', testCommandRunSubcommand);
210 test('run a command which is not found', testCommandRunNotFound); 223 test('run a command which is not found', testCommandRunNotFound);
211 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);
212 } 226 }
213 227
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/debugger.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698