| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:scheduled_test/scheduled_test.dart'; | 5 import 'package:scheduled_test/scheduled_test.dart'; |
| 6 | 6 |
| 7 import 'descriptor.dart' as d; | 7 import 'descriptor.dart' as d; |
| 8 import 'test_pub.dart'; | 8 import 'test_pub.dart'; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 forBothPubGetAndUpgrade((command) { | 11 forBothPubGetAndUpgrade((command) { |
| 12 group("with --no-packages-dir", () { | 12 group("without --packages-dir", () { |
| 13 integration("installs hosted dependencies to the cache", () { | |
| 14 servePackages((builder) { | |
| 15 builder.serve("foo", "1.0.0"); | |
| 16 builder.serve("bar", "1.0.0"); | |
| 17 }); | |
| 18 | |
| 19 d.appDir({"foo": "any", "bar": "any"}).create(); | |
| 20 | |
| 21 pubCommand(command, args: ["--no-packages-dir"]); | |
| 22 | |
| 23 d.nothing("$appPath/packages").validate(); | |
| 24 | |
| 25 d.hostedCache([ | |
| 26 d.dir("foo-1.0.0", [ | |
| 27 d.dir("lib", [d.file("foo.dart", 'main() => "foo 1.0.0";')]) | |
| 28 ]), | |
| 29 d.dir("bar-1.0.0", [ | |
| 30 d.dir("lib", [d.file("bar.dart", 'main() => "bar 1.0.0";')]) | |
| 31 ]) | |
| 32 ]).validate(); | |
| 33 }); | |
| 34 | |
| 35 integration("installs git dependencies to the cache", () { | |
| 36 ensureGit(); | |
| 37 | |
| 38 d.git('foo.git', [ | |
| 39 d.libDir('foo'), | |
| 40 d.libPubspec('foo', '1.0.0') | |
| 41 ]).create(); | |
| 42 | |
| 43 d.appDir({"foo": {"git": "../foo.git"}}).create(); | |
| 44 | |
| 45 pubCommand(command, args: ["--no-packages-dir"]); | |
| 46 | |
| 47 d.nothing("$appPath/packages").validate(); | |
| 48 | |
| 49 d.dir(cachePath, [ | |
| 50 d.dir('git', [ | |
| 51 d.dir('cache', [d.gitPackageRepoCacheDir('foo')]), | |
| 52 d.gitPackageRevisionCacheDir('foo') | |
| 53 ]) | |
| 54 ]).validate(); | |
| 55 }); | |
| 56 | |
| 57 integration("locks path dependencies", () { | |
| 58 d.dir("foo", [ | |
| 59 d.libDir("foo"), | |
| 60 d.libPubspec("foo", "0.0.1") | |
| 61 ]).create(); | |
| 62 | |
| 63 d.dir(appPath, [ | |
| 64 d.appPubspec({ | |
| 65 "foo": {"path": "../foo"} | |
| 66 }) | |
| 67 ]).create(); | |
| 68 | |
| 69 pubCommand(command, args: ["--no-packages-dir"]); | |
| 70 | |
| 71 d.nothing("$appPath/packages").validate(); | |
| 72 d.matcherFile("$appPath/pubspec.lock", contains("foo")); | |
| 73 }); | |
| 74 | |
| 75 integration("removes package directories near entrypoints", () { | 13 integration("removes package directories near entrypoints", () { |
| 76 d.dir(appPath, [ | 14 d.dir(appPath, [ |
| 77 d.appPubspec(), | 15 d.appPubspec(), |
| 78 d.dir("packages"), | 16 d.dir("packages"), |
| 79 d.dir("bin/packages"), | 17 d.dir("bin/packages"), |
| 80 d.dir("web/packages"), | 18 d.dir("web/packages"), |
| 81 d.dir("web/subdir/packages") | 19 d.dir("web/subdir/packages") |
| 82 ]).create(); | 20 ]).create(); |
| 83 | 21 |
| 84 pubCommand(command, args: ["--no-packages-dir"]); | 22 pubCommand(command); |
| 85 | 23 |
| 86 d.dir(appPath, [ | 24 d.dir(appPath, [ |
| 87 d.nothing("packages"), | 25 d.nothing("packages"), |
| 88 d.nothing("bin/packages"), | 26 d.nothing("bin/packages"), |
| 89 d.nothing("web/packages"), | 27 d.nothing("web/packages"), |
| 90 d.nothing("web/subdir/packages") | 28 d.nothing("web/subdir/packages") |
| 91 ]).validate(); | 29 ]).validate(); |
| 92 }); | 30 }); |
| 93 | 31 |
| 94 integration("doesn't remove package directories that pub wouldn't " | 32 integration("doesn't remove package directories that pub wouldn't " |
| 95 "generate", () { | 33 "generate", () { |
| 96 d.dir(appPath, [ | 34 d.dir(appPath, [ |
| 97 d.appPubspec(), | 35 d.appPubspec(), |
| 98 d.dir("packages"), | 36 d.dir("packages"), |
| 99 d.dir("bin/subdir/packages"), | 37 d.dir("bin/subdir/packages"), |
| 100 d.dir("lib/packages") | 38 d.dir("lib/packages") |
| 101 ]).create(); | 39 ]).create(); |
| 102 | 40 |
| 103 pubCommand(command, args: ["--no-packages-dir"]); | 41 pubCommand(command); |
| 104 | 42 |
| 105 d.dir(appPath, [ | 43 d.dir(appPath, [ |
| 106 d.nothing("packages"), | 44 d.nothing("packages"), |
| 107 d.dir("bin/subdir/packages"), | 45 d.dir("bin/subdir/packages"), |
| 108 d.dir("lib/packages") | 46 d.dir("lib/packages") |
| 109 ]).validate(); | 47 ]).validate(); |
| 110 }); | 48 }); |
| 111 }); | 49 }); |
| 112 }); | 50 }); |
| 113 } | 51 } |
| OLD | NEW |