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

Side by Side Diff: test/packages_file_test.dart

Issue 1096723002: Make pub generate .packages file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 5 years, 6 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
« no previous file with comments | « test/get/path/nonexistent_dir_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS d.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 d.file.
4
5 import 'descriptor.dart' as d;
6 import 'test_pub.dart';
7
8 main() {
9 initConfig();
10 forBothPubGetAndUpgrade((command) {
11 integration('.packages file is created', () {
12 servePackages((builder) {
13 builder.serve("foo", "1.2.3",
14 deps: {'baz': '2.2.2'}, contents: [d.dir("lib", [])]);
15 builder.serve("bar", "3.2.1", contents: [d.dir("lib", [])]);
16 builder.serve("baz", "2.2.2",
17 deps: {"bar": "3.2.1"}, contents: [d.dir("lib", [])]);
18 });
19
20 d.appDir({"foo": "1.2.3"}).create();
21
22 pubCommand(command);
23
24 d.dir(appPath, [d.packagesFile({
25 "foo": "1.2.3", "bar": "3.2.1", "baz": "2.2.2", "myapp": "0.0.0"})])
26 .validate();
27 });
28
29 integration('.packages file is overwritten', () {
30 servePackages((builder) {
31 builder.serve("foo", "1.2.3",
32 deps: {'baz': '2.2.2'}, contents: [d.dir("lib", [])]);
33 builder.serve("bar", "3.2.1", contents: [d.dir("lib", [])]);
34 builder.serve("baz", "2.2.2",
35 deps: {"bar": "3.2.1"}, contents: [d.dir("lib", [])]);
36 });
37
38 d.appDir({"foo": "1.2.3"}).create();
39
40 var oldFile = d.dir(appPath, [d.packagesFile({"notFoo": "9.9.9"})]);
41 oldFile.create();
42 oldFile.validate(); // Sanity-check that file was created correctly.
43
44 pubCommand(command);
45
46 d.dir(appPath, [d.packagesFile({
47 "foo": "1.2.3", "bar": "3.2.1", "baz": "2.2.2", "myapp": "0.0.0"})])
48 .validate();
49 });
50
51 integration('.packages file is not created if pub command fails', () {
52 d.appDir({"foo": "1.2.3"}).create();
53
54 pubCommand(command, args: ['--offline'],
55 error: "Could not find package foo in cache.\n");
56
57 d.dir(appPath, [d.nothing('.packages')]).validate();
58 });
59
60 integration('.packages file has relative path to path dependency', () {
61 servePackages((builder) {
62 builder.serve("foo", "1.2.3",
63 deps: {'baz': 'any'}, contents: [d.dir("lib", [])]);
64 builder.serve("baz", "9.9.9",
65 deps: {}, contents: [d.dir("lib", [])]);
66 });
67
68 d.dir("local_baz", [
69 d.libDir("baz", 'baz 3.2.1'),
70 d.libPubspec("baz", "3.2.1")
71 ]).create();
72
73 d.dir(appPath, [
74 d.pubspec({
75 "name": "myapp",
76 "dependencies": {},
77 "dependency_overrides": {
78 "baz": {"path": "../local_baz"},
79 }
80 })
81 ]).create();
82
83 pubCommand(command);
84
85 d.dir(appPath, [d.packagesFile({"myapp": "0.0.0",
86 "baz": "../local_baz"})]).validate();
87 });
88
89 });
90 }
OLDNEW
« no previous file with comments | « test/get/path/nonexistent_dir_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698