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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « lib/src/global_packages.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 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 import 'package:path/path.dart' as p;
6 import 'package:pub/src/io.dart';
7 import 'package:scheduled_test/scheduled_test.dart';
8
9 import '../../descriptor.dart' as d;
10 import '../../test_pub.dart';
11
12 main() {
13 integration('runs a snapshotted script without a .packages file', () {
14 servePackages((builder) {
15 builder.serve("foo", "1.0.0", contents: [
16 d.dir("bin", [
17 d.file("script.dart", "main(args) => print('ok');")
18 ])
19 ]);
20 });
21
22 schedulePub(args: ["global", "activate", "foo"]);
23
24 // Mimic the global packages installed by pub <1.12, which didn't create a
25 // .packages file for global installs.
26 schedule(() {
27 deleteEntry(p.join(sandboxDir, cachePath,
28 'global_packages/foo/.packages'));
29 });
30
31 var pub = pubRun(global: true, args: ["foo:script"]);
32 pub.stdout.expect("ok");
33 pub.shouldExit();
34 });
35
36 integration('runs an unsnapshotted script without a .packages file', () {
37 d.dir("foo", [
38 d.libPubspec("foo", "1.0.0"),
39 d.dir("bin", [
40 d.file("foo.dart", "main() => print('ok');")
41 ])
42 ]).create();
43
44 schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
45
46 schedule(() {
47 deleteEntry(p.join(sandboxDir, cachePath,
48 'global_packages/foo/.packages'));
49 });
50
51 var pub = pubRun(global: true, args: ["foo"]);
52 pub.stdout.expect("ok");
53 pub.shouldExit();
54 });
55 }
OLDNEW
« 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