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

Unified Diff: utils/tests/pub/pub_install_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: 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_install_test.dart
diff --git a/utils/tests/pub/pub_install_test.dart b/utils/tests/pub/pub_install_test.dart
index 2e0408583c6247d315bae40aadce91ebf33ef009..6e27b05abb787f9c8ce24220940e82809e5d3a77 100644
--- a/utils/tests/pub/pub_install_test.dart
+++ b/utils/tests/pub/pub_install_test.dart
@@ -35,30 +35,71 @@ 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('foo'),
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
dir(packagesPath, [
- dir("myapp_name", [pubspec({"name": "myapp_name"})])
+ dir("myapp_name", [
+ file('foo.dart', 'main() => "foo";')
+ ])
]).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: ['install'],
+ output: const RegExp(@"Dependencies installed!$"));
+
+ 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: ['install'],
+ output: '''
+ Dependencies installed!
+ ''');
+
+ packagesDir({"foo": null}).scheduleValidate();
+
+ run();
+ });
group('creates a packages directory in', () {
test('"test/" and its subdirectories', () {
dir(appPath, [
appPubspec([]),
+ libDir('foo'),
dir("test", [dir("subtest")])
]).scheduleCreate();
@@ -68,17 +109,15 @@ main() {
dir(appPath, [
dir("test", [
dir("packages", [
- // TODO(rnystrom): Re-enable this when #4820 is fixed.
- /*
- dir("myapp", [appPubspec([])])
- */
+ dir("myapp", [
+ file('foo.dart', 'main() => "foo";')
+ ])
]),
dir("subtest", [
dir("packages", [
- // TODO(rnystrom): Re-enable this when #4820 is fixed.
- /*
- dir("myapp", [appPubspec([])])
- */
+ dir("myapp", [
+ file('foo.dart', 'main() => "foo";')
+ ])
])
])
])
@@ -90,6 +129,7 @@ main() {
test('"example/" and its subdirectories', () {
dir(appPath, [
appPubspec([]),
+ libDir('foo'),
dir("example", [dir("subexample")])
]).scheduleCreate();
@@ -99,17 +139,15 @@ main() {
dir(appPath, [
dir("example", [
dir("packages", [
- // TODO(rnystrom): Re-enable this when #4820 is fixed.
- /*
- dir("myapp", [appPubspec([])])
- */
+ dir("myapp", [
+ file('foo.dart', 'main() => "foo";')
+ ])
]),
dir("subexample", [
dir("packages", [
- // TODO(rnystrom): Re-enable this when #4820 is fixed.
- /*
- dir("myapp", [appPubspec([])])
- */
+ dir("myapp", [
+ file('foo.dart', 'main() => "foo";')
+ ])
])
])
])
@@ -121,6 +159,7 @@ main() {
test('"bin/"', () {
dir(appPath, [
appPubspec([]),
+ libDir('foo'),
dir("bin")
]).scheduleCreate();
@@ -130,10 +169,9 @@ main() {
dir(appPath, [
dir("bin", [
dir("packages", [
- // TODO(rnystrom): Re-enable this when #4820 is fixed.
- /*
- dir("myapp", [appPubspec([])])
- */
+ dir("myapp", [
+ file('foo.dart', 'main() => "foo";')
+ ])
])
])
]).scheduleValidate();

Powered by Google App Engine
This is Rietveld 408576698