OLD | NEW |
(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 } |
OLD | NEW |