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

Side by Side Diff: packages/args/test/utils.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 | « packages/args/test/usage_test.dart ('k') | packages/async/.analysis_options » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library utils;
6
7 import 'dart:async'; 5 import 'dart:async';
8 6
9 import 'package:args/args.dart'; 7 import 'package:args/args.dart';
10 import 'package:args/command_runner.dart'; 8 import 'package:args/command_runner.dart';
11 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
12 10
13 class CommandRunnerWithFooter extends CommandRunner { 11 class CommandRunnerWithFooter extends CommandRunner {
14 final usageFooter = "Also, footer!"; 12 String get usageFooter => "Also, footer!";
15 13
16 CommandRunnerWithFooter(String executableName, String description) 14 CommandRunnerWithFooter(String executableName, String description)
17 : super(executableName, description); 15 : super(executableName, description);
18 } 16 }
19 17
20 class FooCommand extends Command { 18 class FooCommand extends Command {
21 var hasRun = false; 19 var hasRun = false;
22 20
23 final name = "foo"; 21 final name = "foo";
24 final description = "Set a value."; 22 final description = "Set a value.";
25 final takesArguments = false; 23 final takesArguments = false;
26 24
27 void run() { 25 void run() {
28 hasRun = true; 26 hasRun = true;
29 } 27 }
30 } 28 }
31 29
30 class ValueCommand extends Command<int> {
31 final name = "foo";
32 final description = "Return a value.";
33 final takesArguments = false;
34
35 int run() => 12;
36 }
37
38 class AsyncValueCommand extends Command<String> {
39 final name = "foo";
40 final description = "Return a future.";
41 final takesArguments = false;
42
43 Future<String> run() async => "hi";
44 }
45
46 class MultilineCommand extends Command {
47 var hasRun = false;
48
49 final name = "multiline";
50 final description = "Multi\nline.";
51 final takesArguments = false;
52
53 void run() {
54 hasRun = true;
55 }
56 }
57
58 class MultilineSummaryCommand extends MultilineCommand {
59 String get summary => description;
60 }
61
32 class HiddenCommand extends Command { 62 class HiddenCommand extends Command {
33 var hasRun = false; 63 var hasRun = false;
34 64
35 final name = "hidden"; 65 final name = "hidden";
36 final description = "Set a value."; 66 final description = "Set a value.";
37 final hidden = true; 67 final hidden = true;
38 final takesArguments = false; 68 final takesArguments = false;
39 69
40 void run() { 70 void run() {
41 hasRun = true; 71 hasRun = true;
(...skipping 24 matching lines...) Expand all
66 } 96 }
67 97
68 void throwsIllegalArg(function, {String reason: null}) { 98 void throwsIllegalArg(function, {String reason: null}) {
69 expect(function, throwsArgumentError, reason: reason); 99 expect(function, throwsArgumentError, reason: reason);
70 } 100 }
71 101
72 void throwsFormat(ArgParser parser, List<String> args) { 102 void throwsFormat(ArgParser parser, List<String> args) {
73 expect(() => parser.parse(args), throwsFormatException); 103 expect(() => parser.parse(args), throwsFormatException);
74 } 104 }
75 105
76 Matcher throwsUsageError(message, usage) { 106 Matcher throwsUsageException(message, usage) {
77 return throwsA(predicate((error) { 107 return throwsA(predicate((error) {
78 expect(error, new isInstanceOf<UsageException>()); 108 expect(error, new isInstanceOf<UsageException>());
79 expect(error.message, message); 109 expect(error.message, message);
80 expect(error.usage, usage); 110 expect(error.usage, usage);
81 return true; 111 return true;
82 })); 112 }));
83 } 113 }
OLDNEW
« no previous file with comments | « packages/args/test/usage_test.dart ('k') | packages/async/.analysis_options » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698