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..697d590ac60cec8eb6e56669f2402b27c11c4494 100644 |
--- a/utils/tests/pub/pub_install_test.dart |
+++ b/utils/tests/pub/pub_install_test.dart |
@@ -35,30 +35,69 @@ 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'], |
+ error: const RegExp(@'Warning: Package "foo" does not have a "lib" ' |
+ 'directory.'), |
+ output: const RegExp(@"Dependencies installed!$")); |
+ |
+ run(); |
+ }); |
group('creates a packages directory in', () { |
test('"test/" and its subdirectories', () { |
dir(appPath, [ |
appPubspec([]), |
+ libDir('foo'), |
dir("test", [dir("subtest")]) |
]).scheduleCreate(); |
@@ -68,17 +107,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 +127,7 @@ main() { |
test('"example/" and its subdirectories', () { |
dir(appPath, [ |
appPubspec([]), |
+ libDir('foo'), |
dir("example", [dir("subexample")]) |
]).scheduleCreate(); |
@@ -99,17 +137,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 +157,7 @@ main() { |
test('"bin/"', () { |
dir(appPath, [ |
appPubspec([]), |
+ libDir('foo'), |
dir("bin") |
]).scheduleCreate(); |
@@ -130,10 +167,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(); |
@@ -141,4 +177,23 @@ main() { |
run(); |
}); |
}); |
+ |
+ // TODO(rnystrom): Remove this when old layout support is removed. (#4964) |
+ test('shows a warning if the entrypoint uses the old layout', () { |
+ // The symlink should use the name in the pubspec, not the name of the |
+ // directory. |
+ dir(appPath, [ |
+ pubspec({"name": "myapp_name"}), |
+ file("foo.dart", 'main() => "foo";'), |
+ ]).scheduleCreate(); |
+ |
+ schedulePub(args: ['install'], |
+ error: ''' |
+ Warning: Package "myapp_name" is using a deprecated layout. |
+ See http://www.dartlang.org/docs/pub-package-manager/package-layout.html for details. |
+ ''', |
+ output: const RegExp(@"Dependencies installed!$")); |
+ |
+ run(); |
+ }); |
} |