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

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

Issue 1241673003: Async-step, first cut. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
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=--compile_all --error_on_bad_type --error_on_bad_override 4 // VMOptions=--compile_all --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('notfound')); 188 expect(e, equals('No such command'));
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')); 199 expect(e, equals('Ambiguous command'));
200 out.clear(); 200 out.clear();
201 cmd.runCommand('ankl 55').then(expectAsync((_) { 201 cmd.runCommand('ankl 55').then(expectAsync((_) {
202 expect(out.toString(), equals('executing ankle([55])\n')); 202 expect(out.toString(), equals('executing ankle([55])\n'));
203 })); 203 }));
204 })); 204 }));
205 } 205 }
206 206
207 void testCommandRunAlias() { 207 void testCommandRunAlias() {
208 // Run a simple command. 208 // Run a simple command.
209 StringBuffer out = new StringBuffer(); 209 StringBuffer out = new StringBuffer();
210 var aliasCmd = new TestCommand(out, 'alpha', []); 210 var aliasCmd = new TestCommand(out, 'alpha', []);
211 aliasCmd.alias = 'a'; 211 aliasCmd.alias = 'a';
212 RootCommand cmd = new RootCommand([aliasCmd, 212 RootCommand cmd = new RootCommand([aliasCmd,
213 new TestCommand(out, 'ankle', [])]); 213 new TestCommand(out, 'ankle', [])]);
214 214
215 cmd.runCommand('a 55').then(expectAsync((_) { 215 cmd.runCommand('a 55').then(expectAsync((_) {
216 expect(out.toString(), equals('executing alpha([55])\n')); 216 expect(out.toString(), equals('executing alpha([55])\n'));
217 })); 217 }));
218 } 218 }
219 219
220 main() { 220 main() {
221 test('command completion test suite', testCommandComplete); 221 test('command completion test suite', testCommandComplete);
222 test('run a simple command', testCommandRunSimple); 222 test('run a simple command', testCommandRunSimple);
223 test('run a subcommand', testCommandRunSubcommand); 223 test('run a subcommand', testCommandRunSubcommand);
224 test('run a command which is not found', testCommandRunNotFound); 224 test('run a command which is not found', testCommandRunNotFound);
225 test('run a command which is ambiguous', testCommandRunAmbiguous); 225 test('run a command which is ambiguous', testCommandRunAmbiguous);
226 test('run a command using an alias', testCommandRunAlias); 226 test('run a command using an alias', testCommandRunAlias);
227 } 227 }
228 228
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/break_on_function_test.dart ('k') | runtime/observatory/tests/service/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698