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

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

Issue 814113004: Pull args, intl, logging, shelf, and source_maps out of the SDK. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also csslib. Created 6 years 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 | « pkg/args/test/usage_test.dart ('k') | pkg/csslib/CHANGELOG.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library utils;
6
7 import 'dart:async';
8
9 import 'package:args/args.dart';
10 import 'package:args/command_runner.dart';
11 import 'package:unittest/unittest.dart';
12
13 class CommandRunnerWithFooter extends CommandRunner {
14 final usageFooter = "Also, footer!";
15
16 CommandRunnerWithFooter(String executableName, String description)
17 : super(executableName, description);
18 }
19
20 class FooCommand extends Command {
21 var hasRun = false;
22
23 final name = "foo";
24 final description = "Set a value.";
25 final takesArguments = false;
26
27 void run() {
28 hasRun = true;
29 }
30 }
31
32 class HiddenCommand extends Command {
33 var hasRun = false;
34
35 final name = "hidden";
36 final description = "Set a value.";
37 final hidden = true;
38 final takesArguments = false;
39
40 void run() {
41 hasRun = true;
42 }
43 }
44
45 class AliasedCommand extends Command {
46 var hasRun = false;
47
48 final name = "aliased";
49 final description = "Set a value.";
50 final takesArguments = false;
51 final aliases = const ["alias", "als"];
52
53 void run() {
54 hasRun = true;
55 }
56 }
57
58 class AsyncCommand extends Command {
59 var hasRun = false;
60
61 final name = "async";
62 final description = "Set a value asynchronously.";
63 final takesArguments = false;
64
65 Future run() => new Future.value().then((_) => hasRun = true);
66 }
67
68 void throwsIllegalArg(function, {String reason: null}) {
69 expect(function, throwsArgumentError, reason: reason);
70 }
71
72 void throwsFormat(ArgParser parser, List<String> args) {
73 expect(() => parser.parse(args), throwsFormatException);
74 }
75
76 Matcher throwsUsageError(message, usage) {
77 return throwsA(predicate((error) {
78 expect(error, new isInstanceOf<UsageException>());
79 expect(error.message, message);
80 expect(error.usage, usage);
81 return true;
82 }));
83 }
OLDNEW
« no previous file with comments | « pkg/args/test/usage_test.dart ('k') | pkg/csslib/CHANGELOG.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698