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

Unified Diff: utils/tests/pub/pub_tests.dart

Issue 10207018: First pass at "pub update" implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor cleanup. Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: utils/tests/pub/pub_tests.dart
diff --git a/utils/tests/pub/pub_tests.dart b/utils/tests/pub/pub_tests.dart
index ea13565766b6c8942cb7b397a3e23ec73fcca7e4..91e95d4d4a4bd33aeeb0b69826a8e59f8ba6952a 100644
--- a/utils/tests/pub/pub_tests.dart
+++ b/utils/tests/pub/pub_tests.dart
@@ -13,7 +13,7 @@ main() {
group('running pub with no command', () {
testPub('displays usage',
args: [],
- output: '''
+ output: """
Pub is a package manager for Dart.
Usage:
@@ -23,9 +23,11 @@ main() {
The commands are:
list print the contents of repositories
+ update update a package's dependencies
version print Pub version
- Use "pub help [command]" for more information about a command.''');
+ Use "pub help [command]" for more information about a command.
+ """);
});
group('an unknown command', () {
@@ -33,16 +35,18 @@ main() {
args: ['quylthulg'],
output: '''
Unknown command "quylthulg".
- Run "pub help" to see available commands.''',
+ Run "pub help" to see available commands.
+ ''',
exitCode: 64);
});
- listCommand();
- versionCommand();
+ group('pub list', listCommand);
+ group('pub update', updateCommand);
+ group('pub version', versionCommand);
}
listCommand() {
- group('list cache', () {
+ group('cache', () {
testPub('treats an empty directory as a package',
cache: [
dir('apple'),
@@ -53,14 +57,58 @@ listCommand() {
output: '''
apple
banana
- cherry''');
+ cherry
+ ''');
});
}
+updateCommand() {
+ testPub('adds a dependent package',
+ cache: [
+ dir('foo', [
+ file('foo.dart', 'main() => "foo";')
+ ])
+ ],
+ app: dir('myapp', [
+ file('pubspec', 'foo')
+ ]),
+ args: ['update'],
+ expectedPackageDir: [
+ dir('foo', [
+ file('foo.dart', 'main() => "foo";')
+ ])
+ ],
+ output: '');
+
+ testPub('adds a transitively dependent package',
+ cache: [
+ dir('foo', [
+ file('foo.dart', 'main() => "foo";'),
+ file('pubspec', 'bar')
+ ]),
+ dir('bar', [
+ file('bar.dart', 'main() => "bar";'),
+ ])
+ ],
+ app: dir('myapp', [
+ file('pubspec', 'foo')
+ ]),
+ args: ['update'],
+ expectedPackageDir: [
+ dir('foo', [
+ file('foo.dart', 'main() => "foo";')
+ ]),
+ dir('bar', [
+ file('bar.dart', 'main() => "bar";'),
+ ])
+ ],
+ output: '');
+}
+
versionCommand() {
- group('the version command', () {
- testPub('displays the current version',
- args: ['version'],
- output: 'Pub 0.0.0');
- });
+ testPub('displays the current version',
+ args: ['version'],
+ output: '''
+ Pub 0.0.0
+ ''');
}

Powered by Google App Engine
This is Rietveld 408576698