| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS d.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 d.file. | 3 // BSD-style license that can be found in the LICENSE d.file. |
| 4 | 4 |
| 5 import 'package:pub/src/exit_codes.dart' as exit_codes; |
| 6 |
| 5 import 'descriptor.dart' as d; | 7 import 'descriptor.dart' as d; |
| 6 import 'test_pub.dart'; | 8 import 'test_pub.dart'; |
| 7 | 9 |
| 8 main() { | 10 main() { |
| 9 forBothPubGetAndUpgrade((command) { | 11 forBothPubGetAndUpgrade((command) { |
| 10 integration('.packages file is created', () { | 12 integration('.packages file is created', () { |
| 11 servePackages((builder) { | 13 servePackages((builder) { |
| 12 builder.serve("foo", "1.2.3", | 14 builder.serve("foo", "1.2.3", |
| 13 deps: {'baz': '2.2.2'}, contents: [d.dir("lib", [])]); | 15 deps: {'baz': '2.2.2'}, contents: [d.dir("lib", [])]); |
| 14 builder.serve("bar", "3.2.1", contents: [d.dir("lib", [])]); | 16 builder.serve("bar", "3.2.1", contents: [d.dir("lib", [])]); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 .validate(); | 55 .validate(); |
| 54 }); | 56 }); |
| 55 | 57 |
| 56 integration('.packages file is not created if pub command fails', () { | 58 integration('.packages file is not created if pub command fails', () { |
| 57 d.dir(appPath, [ | 59 d.dir(appPath, [ |
| 58 d.appPubspec({"foo": "1.2.3"}), | 60 d.appPubspec({"foo": "1.2.3"}), |
| 59 d.dir('lib') | 61 d.dir('lib') |
| 60 ]).create(); | 62 ]).create(); |
| 61 | 63 |
| 62 pubCommand(command, args: ['--offline'], | 64 pubCommand(command, args: ['--offline'], |
| 63 error: "Could not find package foo in cache.\n"); | 65 error: "Could not find package foo in cache.\n" |
| 66 "Depended on by:\n" |
| 67 "- myapp", |
| 68 exitCode: exit_codes.UNAVAILABLE); |
| 64 | 69 |
| 65 d.dir(appPath, [d.nothing('.packages')]).validate(); | 70 d.dir(appPath, [d.nothing('.packages')]).validate(); |
| 66 }); | 71 }); |
| 67 | 72 |
| 68 integration('.packages file has relative path to path dependency', () { | 73 integration('.packages file has relative path to path dependency', () { |
| 69 servePackages((builder) { | 74 servePackages((builder) { |
| 70 builder.serve("foo", "1.2.3", | 75 builder.serve("foo", "1.2.3", |
| 71 deps: {'baz': 'any'}, contents: [d.dir("lib", [])]); | 76 deps: {'baz': 'any'}, contents: [d.dir("lib", [])]); |
| 72 builder.serve("baz", "9.9.9", | 77 builder.serve("baz", "9.9.9", |
| 73 deps: {}, contents: [d.dir("lib", [])]); | 78 deps: {}, contents: [d.dir("lib", [])]); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 93 | 98 |
| 94 d.dir(appPath, [ | 99 d.dir(appPath, [ |
| 95 d.packagesFile({ | 100 d.packagesFile({ |
| 96 "myapp": ".", | 101 "myapp": ".", |
| 97 "baz": "../local_baz" | 102 "baz": "../local_baz" |
| 98 }) | 103 }) |
| 99 ]).validate(); | 104 ]).validate(); |
| 100 }); | 105 }); |
| 101 }); | 106 }); |
| 102 } | 107 } |
| OLD | NEW |