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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/get/path/nonexistent_dir_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/packages_file_test.dart
diff --git a/test/packages_file_test.dart b/test/packages_file_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..742d1b24b951b0f918bd8906418c8046be771ca8
--- /dev/null
+++ b/test/packages_file_test.dart
@@ -0,0 +1,90 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS d.file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE d.file.
+
+import 'descriptor.dart' as d;
+import 'test_pub.dart';
+
+main() {
+ initConfig();
+ forBothPubGetAndUpgrade((command) {
+ integration('.packages file is created', () {
+ servePackages((builder) {
+ builder.serve("foo", "1.2.3",
+ deps: {'baz': '2.2.2'}, contents: [d.dir("lib", [])]);
+ builder.serve("bar", "3.2.1", contents: [d.dir("lib", [])]);
+ builder.serve("baz", "2.2.2",
+ deps: {"bar": "3.2.1"}, contents: [d.dir("lib", [])]);
+ });
+
+ d.appDir({"foo": "1.2.3"}).create();
+
+ pubCommand(command);
+
+ d.dir(appPath, [d.packagesFile({
+ "foo": "1.2.3", "bar": "3.2.1", "baz": "2.2.2", "myapp": "0.0.0"})])
+ .validate();
+ });
+
+ integration('.packages file is overwritten', () {
+ servePackages((builder) {
+ builder.serve("foo", "1.2.3",
+ deps: {'baz': '2.2.2'}, contents: [d.dir("lib", [])]);
+ builder.serve("bar", "3.2.1", contents: [d.dir("lib", [])]);
+ builder.serve("baz", "2.2.2",
+ deps: {"bar": "3.2.1"}, contents: [d.dir("lib", [])]);
+ });
+
+ d.appDir({"foo": "1.2.3"}).create();
+
+ var oldFile = d.dir(appPath, [d.packagesFile({"notFoo": "9.9.9"})]);
+ oldFile.create();
+ oldFile.validate(); // Sanity-check that file was created correctly.
+
+ pubCommand(command);
+
+ d.dir(appPath, [d.packagesFile({
+ "foo": "1.2.3", "bar": "3.2.1", "baz": "2.2.2", "myapp": "0.0.0"})])
+ .validate();
+ });
+
+ integration('.packages file is not created if pub command fails', () {
+ d.appDir({"foo": "1.2.3"}).create();
+
+ pubCommand(command, args: ['--offline'],
+ error: "Could not find package foo in cache.\n");
+
+ d.dir(appPath, [d.nothing('.packages')]).validate();
+ });
+
+ integration('.packages file has relative path to path dependency', () {
+ servePackages((builder) {
+ builder.serve("foo", "1.2.3",
+ deps: {'baz': 'any'}, contents: [d.dir("lib", [])]);
+ builder.serve("baz", "9.9.9",
+ deps: {}, contents: [d.dir("lib", [])]);
+ });
+
+ d.dir("local_baz", [
+ d.libDir("baz", 'baz 3.2.1'),
+ d.libPubspec("baz", "3.2.1")
+ ]).create();
+
+ d.dir(appPath, [
+ d.pubspec({
+ "name": "myapp",
+ "dependencies": {},
+ "dependency_overrides": {
+ "baz": {"path": "../local_baz"},
+ }
+ })
+ ]).create();
+
+ pubCommand(command);
+
+ d.dir(appPath, [d.packagesFile({"myapp": "0.0.0",
+ "baz": "../local_baz"})]).validate();
+ });
+
+ });
+}
« 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