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

Side by Side Diff: sdk/lib/_internal/pub/test/hosted/offline_test.dart

Issue 19592015: Get rid of hokey dependencyMapList stuff. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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 library pub_tests; 5 library pub_tests;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import '../descriptor.dart' as d; 9 import '../descriptor.dart' as d;
10 import '../test_pub.dart'; 10 import '../test_pub.dart';
11 11
12 main() { 12 main() {
13 initConfig(); 13 initConfig();
14 14
15 forBothPubInstallAndUpdate((command) { 15 forBothPubInstallAndUpdate((command) {
16 integration('updates a package using the cache', () { 16 integration('updates a package using the cache', () {
17 // Run the server so that we know what URL to use in the system cache. 17 // Run the server so that we know what URL to use in the system cache.
18 servePackages([]); 18 servePackages([]);
19 19
20 d.cacheDir({ 20 d.cacheDir({
21 "foo": ["1.2.2", "1.2.3"], 21 "foo": ["1.2.2", "1.2.3"],
22 "bar": ["1.2.3"] 22 "bar": ["1.2.3"]
23 }, includePubspecs: true).create(); 23 }, includePubspecs: true).create();
24 24
25 d.appDir([ 25 d.appDir({
26 dependencyMap("foo", "any"), 26 "foo": "any",
27 dependencyMap("bar", "any") 27 "bar": "any"
28 ]).create(); 28 }).create();
29 29
30 var warning = null; 30 var warning = null;
31 if (command == RunCommand.update) { 31 if (command == RunCommand.update) {
32 warning = "Warning: Updating when offline may not update you " 32 warning = "Warning: Updating when offline may not update you "
33 "to the latest versions of your dependencies."; 33 "to the latest versions of your dependencies.";
34 } 34 }
35 35
36 pubCommand(command, args: ['--offline'], warning: warning); 36 pubCommand(command, args: ['--offline'], warning: warning);
37 37
38 d.packagesDir({ 38 d.packagesDir({
39 "foo": "1.2.3", 39 "foo": "1.2.3",
40 "bar": "1.2.3" 40 "bar": "1.2.3"
41 }).validate(); 41 }).validate();
42 }); 42 });
43 43
44 integration('fails gracefully if a dependency is not cached', () { 44 integration('fails gracefully if a dependency is not cached', () {
45 // Run the server so that we know what URL to use in the system cache. 45 // Run the server so that we know what URL to use in the system cache.
46 servePackages([]); 46 servePackages([]);
47 47
48 d.appDir([ 48 d.appDir({"foo": "any"}).create();
49 dependencyMap("foo", "any")
50 ]).create();
51 49
52 pubCommand(command, args: ['--offline'], 50 pubCommand(command, args: ['--offline'],
53 error: 'Could not find package "foo" in cache.'); 51 error: 'Could not find package "foo" in cache.');
54 }); 52 });
55 53
56 integration('fails gracefully no cached versions match', () { 54 integration('fails gracefully no cached versions match', () {
57 // Run the server so that we know what URL to use in the system cache. 55 // Run the server so that we know what URL to use in the system cache.
58 servePackages([]); 56 servePackages([]);
59 57
60 d.cacheDir({ 58 d.cacheDir({
61 "foo": ["1.2.2", "1.2.3"] 59 "foo": ["1.2.2", "1.2.3"]
62 }, includePubspecs: true).create(); 60 }, includePubspecs: true).create();
63 61
64 d.appDir([ 62 d.appDir({"foo": ">2.0.0"}).create();
65 dependencyMap("foo", ">2.0.0")
66 ]).create();
67 63
68 pubCommand(command, args: ['--offline'], error: 64 pubCommand(command, args: ['--offline'], error:
69 "Package 'foo' has no versions that match >2.0.0 derived from:\n" 65 "Package 'foo' has no versions that match >2.0.0 derived from:\n"
70 "- 'myapp' depends on version >2.0.0"); 66 "- 'myapp' depends on version >2.0.0");
71 }); 67 });
72 }); 68 });
73 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698