| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 library pub_tests; | |
| 6 | |
| 7 import 'package:path/path.dart' as p; | |
| 8 import 'package:scheduled_test/scheduled_test.dart'; | |
| 9 | |
| 10 import '../../../lib/src/io.dart'; | |
| 11 import '../../descriptor.dart' as d; | |
| 12 import '../../test_pub.dart'; | |
| 13 | |
| 14 main() { | |
| 15 initConfig(); | |
| 16 // Regression test for issue 20947. | |
| 17 integration( | |
| 18 'checks out an unfetched and locked revision of a cached ' 'repository', | |
| 19 () { | |
| 20 ensureGit(); | |
| 21 | |
| 22 // In order to get a lockfile that refers to a newer revision than is in the | |
| 23 // cache, we'll switch between two caches. First we ensure that the repo is | |
| 24 // in the first cache. | |
| 25 d.git('foo.git', [d.libDir('foo'), d.libPubspec('foo', '1.0.0')]).create(); | |
| 26 | |
| 27 d.appDir({ | |
| 28 "foo": { | |
| 29 "git": "../foo.git" | |
| 30 } | |
| 31 }).create(); | |
| 32 | |
| 33 pubGet(); | |
| 34 | |
| 35 // Switch to a new cache. | |
| 36 schedule( | |
| 37 () => | |
| 38 renameDir(p.join(sandboxDir, cachePath), p.join(sandboxDir, "$cacheP
ath.old"))); | |
| 39 | |
| 40 // Make the lockfile point to a new revision of the git repository. | |
| 41 d.git( | |
| 42 'foo.git', | |
| 43 [d.libDir('foo', 'foo 2'), d.libPubspec('foo', '1.0.0')]).commit(); | |
| 44 | |
| 45 pubUpgrade(output: contains("Changed 1 dependency!")); | |
| 46 | |
| 47 // Switch back to the old cache. | |
| 48 schedule(() { | |
| 49 var cacheDir = p.join(sandboxDir, cachePath); | |
| 50 deleteEntry(cacheDir); | |
| 51 renameDir(p.join(sandboxDir, "$cachePath.old"), cacheDir); | |
| 52 }); | |
| 53 | |
| 54 // Get the updated version of the git dependency based on the lockfile. | |
| 55 pubGet(); | |
| 56 | |
| 57 d.dir( | |
| 58 cachePath, | |
| 59 [ | |
| 60 d.dir( | |
| 61 'git', | |
| 62 [ | |
| 63 d.dir('cache', [d.gitPackageRepoCacheDir('foo')]), | |
| 64 d.gitPackageRevisionCacheDir('foo'), | |
| 65 d.gitPackageRevisionCacheDir('foo', 2)])]).validate(); | |
| 66 | |
| 67 d.dir( | |
| 68 packagesPath, | |
| 69 [d.dir('foo', [d.file('foo.dart', 'main() => "foo 2";')])]).validate(); | |
| 70 }); | |
| 71 } | |
| OLD | NEW |