| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:path/path.dart' as p; | 5 import 'package:path/path.dart' as p; |
| 6 import 'package:pub/src/io.dart'; | 6 import 'package:pub/src/io.dart'; |
| 7 import 'package:scheduled_test/scheduled_test.dart'; |
| 7 | 8 |
| 8 import '../../descriptor.dart' as d; | 9 import '../../descriptor.dart' as d; |
| 9 import '../../test_pub.dart'; | 10 import '../../test_pub.dart'; |
| 10 | 11 |
| 11 main() { | 12 main() { |
| 12 integration('activating a hosted package deactivates the path one', () { | 13 integration('activating a hosted package deactivates the path one', () { |
| 13 servePackages((builder) { | 14 servePackages((builder) { |
| 14 builder.serve("foo", "1.0.0", contents: [ | 15 builder.serve("foo", "1.0.0", contents: [ |
| 15 d.dir("bin", [ | 16 d.dir("bin", [ |
| 16 d.file("foo.dart", "main(args) => print('hosted');") | 17 d.file("foo.dart", "main(args) => print('hosted');") |
| 17 ]) | 18 ]) |
| 18 ]); | 19 ]); |
| 19 }); | 20 }); |
| 20 | 21 |
| 21 d.dir("foo", [ | 22 d.dir("foo", [ |
| 22 d.libPubspec("foo", "2.0.0"), | 23 d.libPubspec("foo", "2.0.0"), |
| 23 d.dir("bin", [ | 24 d.dir("bin", [ |
| 24 d.file("foo.dart", "main() => print('path');") | 25 d.file("foo.dart", "main() => print('path');") |
| 25 ]) | 26 ]) |
| 26 ]).create(); | 27 ]).create(); |
| 27 | 28 |
| 28 schedulePub(args: ["global", "activate", "foo"]); | 29 schedulePub(args: ["global", "activate", "foo"]); |
| 29 | 30 |
| 30 var path = canonicalize(p.join(sandboxDir, "foo")); | 31 var path = canonicalize(p.join(sandboxDir, "foo")); |
| 31 schedulePub(args: ["global", "activate", "-spath", "../foo"], output: """ | 32 schedulePub( |
| 32 Package foo is currently active at version 1.0.0. | 33 args: ["global", "activate", "-spath", "../foo"], |
| 33 Activated foo 2.0.0 at path "$path"."""); | 34 output: allOf([ |
| 35 contains("Package foo is currently active at version 1.0.0."), |
| 36 contains('Activated foo 2.0.0 at path "$path".') |
| 37 ])); |
| 34 | 38 |
| 35 // Should now run the path one. | 39 // Should now run the path one. |
| 36 var pub = pubRun(global: true, args: ["foo"]); | 40 var pub = pubRun(global: true, args: ["foo"]); |
| 37 pub.stdout.expect("path"); | 41 pub.stdout.expect("path"); |
| 38 pub.shouldExit(); | 42 pub.shouldExit(); |
| 39 }); | 43 }); |
| 40 } | 44 } |
| OLD | NEW |