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('checks out an unfetched and locked revision of a cached ' | |
18 'repository', () { | |
19 ensureGit(); | |
20 | |
21 // In order to get a lockfile that refers to a newer revision than is in the | |
22 // cache, we'll switch between two caches. First we ensure that the repo is | |
23 // in the first cache. | |
24 d.git('foo.git', [ | |
25 d.libDir('foo'), | |
26 d.libPubspec('foo', '1.0.0') | |
27 ]).create(); | |
28 | |
29 d.appDir({"foo": {"git": "../foo.git"}}).create(); | |
30 | |
31 pubGet(); | |
32 | |
33 // Switch to a new cache. | |
34 schedule(() => renameDir( | |
35 p.join(sandboxDir, cachePath), p.join(sandboxDir, "$cachePath.old"))); | |
36 | |
37 // Make the lockfile point to a new revision of the git repository. | |
38 d.git('foo.git', [ | |
39 d.libDir('foo', 'foo 2'), | |
40 d.libPubspec('foo', '1.0.0') | |
41 ]).commit(); | |
42 | |
43 pubUpgrade(output: contains("Changed 1 dependency!")); | |
44 | |
45 // Switch back to the old cache. | |
46 schedule(() { | |
47 var cacheDir = p.join(sandboxDir, cachePath); | |
48 deleteEntry(cacheDir); | |
49 renameDir(p.join(sandboxDir, "$cachePath.old"), cacheDir); | |
50 }); | |
51 | |
52 // Get the updated version of the git dependency based on the lockfile. | |
53 pubGet(); | |
54 | |
55 d.dir(cachePath, [ | |
56 d.dir('git', [ | |
57 d.dir('cache', [d.gitPackageRepoCacheDir('foo')]), | |
58 d.gitPackageRevisionCacheDir('foo'), | |
59 d.gitPackageRevisionCacheDir('foo', 2) | |
60 ]) | |
61 ]).validate(); | |
62 | |
63 d.dir(packagesPath, [ | |
64 d.dir('foo', [ | |
65 d.file('foo.dart', 'main() => "foo 2";') | |
66 ]) | |
67 ]).validate(); | |
68 }); | |
69 } | |
OLD | NEW |