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

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

Issue 10382094: Refactor the pub tests. (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 side-by-side diff with in-line comments
Download patch
Index: utils/tests/pub/pub_test.dart
diff --git a/utils/tests/pub/pub_test.dart b/utils/tests/pub/pub_test.dart
index a8b242b032a298357f6fd3254bb7b28908480abc..0b154684fe1057b24f8c3de70a7cde8fe4a3023e 100644
--- a/utils/tests/pub/pub_test.dart
+++ b/utils/tests/pub/pub_test.dart
@@ -31,30 +31,27 @@ final VERSION_STRING = '''
''';
main() {
- testPub('running pub with no command displays usage',
- args: [],
- output: USAGE_STRING);
+ test('running pub with no command displays usage', () =>
+ runPub(args: [], output: USAGE_STRING));
- testPub('running pub with just --help displays usage',
- args: ['--help'],
- output: USAGE_STRING);
+ test('running pub with just --help displays usage', () =>
+ runPub(args: ['--help'], output: USAGE_STRING));
- testPub('running pub with just -h displays usage',
- args: ['-h'],
- output: USAGE_STRING);
+ test('running pub with just -h displays usage', () =>
+ runPub(args: ['-h'], output: USAGE_STRING));
- testPub('running pub with just --version displays version',
- args: ['--version'],
- output: VERSION_STRING);
+ test('running pub with just --version displays version', () =>
+ runPub(args: ['--version'], output: VERSION_STRING));
group('an unknown command', () {
- testPub('displays an error message',
- args: ['quylthulg'],
- output: '''
- Unknown command "quylthulg".
- Run "pub help" to see available commands.
- ''',
- exitCode: 64);
+ test('displays an error message', () {
+ runPub(args: ['quylthulg'],
+ output: '''
+ Unknown command "quylthulg".
+ Run "pub help" to see available commands.
+ ''',
+ exitCode: 64);
+ });
});
group('pub list', listCommand);
@@ -64,48 +61,54 @@ main() {
listCommand() {
group('cache', () {
- testPub('treats an empty directory as a package',
- cache: [
+ test('treats an empty directory as a package', () {
+ dir(cachePath, [
dir('sdk', [
dir('apple'),
dir('banana'),
dir('cherry')
])
- ],
- args: ['list', 'cache'],
- output: '''
- From system cache:
- apple from sdk
- banana from sdk
- cherry from sdk
- ''');
+ ]).scheduleCreate();
+
+ runPub(args: ['list', 'cache'],
+ output: '''
+ From system cache:
+ apple from sdk
+ banana from sdk
+ cherry from sdk
+ ''');
+ });
});
}
installCommand() {
- testPub('adds a dependent package',
- sdk: [
+ test('adds a dependent package', () {
+ dir(sdkPath, [
dir('lib', [
dir('foo', [
file('foo.dart', 'main() => "foo";')
])
])
- ],
- app: dir('myapp', [
+ ]).scheduleCreate();
+
+ dir(appPath, [
file('pubspec', 'dependencies:\n- foo')
- ]),
- args: ['install'],
- expectedPackageDir: [
+ ]).scheduleCreate();
+
+ dir(packagesPath, [
dir('foo', [
file('foo.dart', 'main() => "foo";')
])
- ],
- output: '''
- Dependencies installed!
- ''');
+ ]).scheduleValidate();
+
+ runPub(args: ['install'],
+ output: '''
+ Dependencies installed!
+ ''');
+ });
- testPub('adds a transitively dependent package',
- sdk: [
+ test('adds a transitively dependent package', () {
+ dir(sdkPath, [
dir('lib', [
dir('foo', [
file('foo.dart', 'main() => "foo";'),
@@ -115,26 +118,29 @@ installCommand() {
file('bar.dart', 'main() => "bar";'),
])
])
- ],
- app: dir('myapp', [
+ ]).scheduleCreate();
+
+ dir(appPath, [
file('pubspec', 'dependencies:\n- foo')
- ]),
- args: ['install'],
- expectedPackageDir: [
+ ]).scheduleCreate();
+
+ dir(packagesPath, [
dir('foo', [
file('foo.dart', 'main() => "foo";')
]),
dir('bar', [
file('bar.dart', 'main() => "bar";'),
])
- ],
- output: '''
- Dependencies installed!
- ''');
+ ]).scheduleValidate();
+
+ runPub(args: ['install'],
+ output: '''
+ Dependencies installed!
+ ''');
+ });
}
versionCommand() {
- testPub('displays the current version',
- args: ['version'],
- output: VERSION_STRING);
+ test('displays the current version', () =>
+ runPub(args: ['version'], output: VERSION_STRING));
}

Powered by Google App Engine
This is Rietveld 408576698