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

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

Issue 10916190: Support both new and old style package layouts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 8 years, 3 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_update_test.dart
diff --git a/utils/tests/pub/pub_update_test.dart b/utils/tests/pub/pub_update_test.dart
index c298bba274f79c246f005225aff872f6823f1b2f..64d74025c98094b77143434a0452ee97b81c791a 100644
--- a/utils/tests/pub/pub_update_test.dart
+++ b/utils/tests/pub/pub_update_test.dart
@@ -35,23 +35,63 @@ main() {
});
});
- // TODO(rnystrom): Re-enable this when #4820 is fixed.
- /*
- test('creates a self-referential symlink', () {
+ test('adds itself to the packages', () {
// The symlink should use the name in the pubspec, not the name of the
// directory.
dir(appPath, [
- pubspec({"name": "myapp_name"})
+ pubspec({"name": "myapp_name"}),
+ libDir('myapp_name')
]).scheduleCreate();
schedulePub(args: ['update'],
output: const RegExp(@"Dependencies updated!$"));
dir(packagesPath, [
- dir("myapp_name", [pubspec({"name": "myapp_name"})])
+ dir("myapp_name", [
+ file('myapp_name.dart', 'main() => "myapp_name";')
+ ])
]).scheduleValidate();
run();
});
- */
+
+ test('does not adds itself to the packages if it has no "lib" directory', () {
+ // The symlink should use the name in the pubspec, not the name of the
+ // directory.
+ dir(appPath, [
+ pubspec({"name": "myapp_name"}),
+ ]).scheduleCreate();
+
+ schedulePub(args: ['update'],
+ output: const RegExp(@"Dependencies updated!$"));
+
+ dir(packagesPath, [
+ nothing("myapp_name")
+ ]).scheduleValidate();
+
+ run();
+ });
+
+ test('does not add a package if it does not have a "lib" directory', () {
+ // Using an SDK source, but this should be true of all sources.
+ dir(sdkPath, [
+ file('revision', '1234'),
+ dir('pkg', [
+ dir('foo', [])
+ ])
+ ]).scheduleCreate();
+
+ dir(appPath, [
+ pubspec({"name": "myapp", "dependencies": {"foo": {"sdk": "foo"}}})
+ ]).scheduleCreate();
+
+ schedulePub(args: ['update'],
+ output: '''
+ Dependencies updated!
+ ''');
+
+ packagesDir({"foo": null}).scheduleValidate();
+
+ run();
+ });
}

Powered by Google App Engine
This is Rietveld 408576698