| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2012, 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 library pub_tests; | 5 library pub_tests; |
| 6 | 6 |
| 7 import 'dart:json' as json; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'descriptor.dart' as d; | 9 import 'descriptor.dart' as d; |
| 10 import 'test_pub.dart'; | 10 import 'test_pub.dart'; |
| 11 | 11 |
| 12 main() { | 12 main() { |
| 13 initConfig(); | 13 initConfig(); |
| 14 | 14 |
| 15 forBothPubInstallAndUpdate((command) { | 15 forBothPubInstallAndUpdate((command) { |
| 16 integration('fails gracefully on a dependency from an unknown source', () { | 16 integration('fails gracefully on a dependency from an unknown source', () { |
| 17 d.appDir({"foo": {"bad": "foo"}}).create(); | 17 d.appDir({"foo": {"bad": "foo"}}).create(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // Depend on "foo" from a valid source. | 42 // Depend on "foo" from a valid source. |
| 43 d.dir(appPath, [ | 43 d.dir(appPath, [ |
| 44 d.appPubspec({ | 44 d.appPubspec({ |
| 45 "foo": {"path": "../foo"} | 45 "foo": {"path": "../foo"} |
| 46 }) | 46 }) |
| 47 ]).create(); | 47 ]).create(); |
| 48 | 48 |
| 49 // But lock it to a bad one. | 49 // But lock it to a bad one. |
| 50 d.dir(appPath, [ | 50 d.dir(appPath, [ |
| 51 d.file("pubspec.lock", json.stringify({ | 51 d.file("pubspec.lock", JSON.encode({ |
| 52 'packages': { | 52 'packages': { |
| 53 'foo': { | 53 'foo': { |
| 54 'version': '0.0.0', | 54 'version': '0.0.0', |
| 55 'source': 'bad', | 55 'source': 'bad', |
| 56 'description': { | 56 'description': { |
| 57 'name': 'foo' | 57 'name': 'foo' |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 })) | 61 })) |
| 62 ]).create(); | 62 ]).create(); |
| 63 | 63 |
| 64 pubCommand(command); | 64 pubCommand(command); |
| 65 | 65 |
| 66 // Should update to the new one. | 66 // Should update to the new one. |
| 67 d.dir(packagesPath, [ | 67 d.dir(packagesPath, [ |
| 68 d.dir("foo", [ | 68 d.dir("foo", [ |
| 69 d.file("foo.dart", 'main() => "foo";') | 69 d.file("foo.dart", 'main() => "foo";') |
| 70 ]) | 70 ]) |
| 71 ]).validate(); | 71 ]).validate(); |
| 72 }); | 72 }); |
| 73 }); | 73 }); |
| 74 } | 74 } |
| OLD | NEW |