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

Unified Diff: test/global/run/runs_script_without_packages_file_test.dart

Issue 1292003005: Don't crash for pre-1.12 global packages. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 4 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 | « lib/src/global_packages.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/global/run/runs_script_without_packages_file_test.dart
diff --git a/test/global/run/runs_script_without_packages_file_test.dart b/test/global/run/runs_script_without_packages_file_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6aed90dbb25ea6ea607beedeb02e026319558552
--- /dev/null
+++ b/test/global/run/runs_script_without_packages_file_test.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS 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 file.
+
+import 'package:path/path.dart' as p;
+import 'package:pub/src/io.dart';
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../../descriptor.dart' as d;
+import '../../test_pub.dart';
+
+main() {
+ integration('runs a snapshotted script without a .packages file', () {
+ servePackages((builder) {
+ builder.serve("foo", "1.0.0", contents: [
+ d.dir("bin", [
+ d.file("script.dart", "main(args) => print('ok');")
+ ])
+ ]);
+ });
+
+ schedulePub(args: ["global", "activate", "foo"]);
+
+ // Mimic the global packages installed by pub <1.12, which didn't create a
+ // .packages file for global installs.
+ schedule(() {
+ deleteEntry(p.join(sandboxDir, cachePath,
+ 'global_packages/foo/.packages'));
+ });
+
+ var pub = pubRun(global: true, args: ["foo:script"]);
+ pub.stdout.expect("ok");
+ pub.shouldExit();
+ });
+
+ integration('runs an unsnapshotted script without a .packages file', () {
+ d.dir("foo", [
+ d.libPubspec("foo", "1.0.0"),
+ d.dir("bin", [
+ d.file("foo.dart", "main() => print('ok');")
+ ])
+ ]).create();
+
+ schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
+
+ schedule(() {
+ deleteEntry(p.join(sandboxDir, cachePath,
+ 'global_packages/foo/.packages'));
+ });
+
+ var pub = pubRun(global: true, args: ["foo"]);
+ pub.stdout.expect("ok");
+ pub.shouldExit();
+ });
+}
« no previous file with comments | « lib/src/global_packages.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698