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

Side by Side Diff: utils/tests/pub/pub_tests.dart

Issue 10154010: test rename overhaul: step 3 _tests.dart => _test.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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('pub_tests');
6
7 #import('dart:io');
8
9 #import('test_pub.dart');
10 #import('../../../lib/unittest/unittest.dart');
11
12 main() {
13 group('running pub with no command', () {
14 testPub('displays usage',
15 args: [],
16 output: """
17 Pub is a package manager for Dart.
18
19 Usage:
20
21 pub command [arguments]
22
23 The commands are:
24
25 list print the contents of repositories
26 update update a package's dependencies
27 version print Pub version
28
29 Use "pub help [command]" for more information about a command.
30 """);
31 });
32
33 group('an unknown command', () {
34 testPub('displays an error message',
35 args: ['quylthulg'],
36 output: '''
37 Unknown command "quylthulg".
38 Run "pub help" to see available commands.
39 ''',
40 exitCode: 64);
41 });
42
43 group('pub list', listCommand);
44 group('pub update', updateCommand);
45 group('pub version', versionCommand);
46 }
47
48 listCommand() {
49 group('cache', () {
50 testPub('treats an empty directory as a package',
51 cache: [
52 dir('apple'),
53 dir('banana'),
54 dir('cherry')
55 ],
56 args: ['list', 'cache'],
57 output: '''
58 apple
59 banana
60 cherry
61 ''');
62 });
63 }
64
65 updateCommand() {
66 testPub('adds a dependent package',
67 cache: [
68 dir('foo', [
69 file('foo.dart', 'main() => "foo";')
70 ])
71 ],
72 app: dir('myapp', [
73 file('pubspec', 'foo')
74 ]),
75 args: ['update'],
76 expectedPackageDir: [
77 dir('foo', [
78 file('foo.dart', 'main() => "foo";')
79 ])
80 ],
81 output: '');
82
83 testPub('adds a transitively dependent package',
84 cache: [
85 dir('foo', [
86 file('foo.dart', 'main() => "foo";'),
87 file('pubspec', 'bar')
88 ]),
89 dir('bar', [
90 file('bar.dart', 'main() => "bar";'),
91 ])
92 ],
93 app: dir('myapp', [
94 file('pubspec', 'foo')
95 ]),
96 args: ['update'],
97 expectedPackageDir: [
98 dir('foo', [
99 file('foo.dart', 'main() => "foo";')
100 ]),
101 dir('bar', [
102 file('bar.dart', 'main() => "bar";'),
103 ])
104 ],
105 output: '');
106 }
107
108 versionCommand() {
109 testPub('displays the current version',
110 args: ['version'],
111 output: '''
112 Pub 0.0.0
113 ''');
114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698