OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE d.file. |
| 4 |
| 5 library pub_tests; |
| 6 |
| 7 import 'dart:convert'; |
| 8 |
| 9 import 'descriptor.dart' as d; |
| 10 import 'test_pub.dart'; |
| 11 |
| 12 main() { |
| 13 initConfig(); |
| 14 |
| 15 forBothPubGetAndUpgrade((command) { |
| 16 integration('fails gracefully on a dependency from an unknown source', () { |
| 17 d.appDir({ |
| 18 "foo": { |
| 19 "bad": "foo" |
| 20 } |
| 21 }).create(); |
| 22 |
| 23 pubCommand( |
| 24 command, |
| 25 error: 'Package myapp depends on foo from unknown source "bad".'); |
| 26 }); |
| 27 |
| 28 integration( |
| 29 'fails gracefully on transitive dependency from an unknown ' 'source', |
| 30 () { |
| 31 d.dir( |
| 32 'foo', |
| 33 [d.libDir('foo', 'foo 0.0.1'), d.libPubspec('foo', '0.0.1', deps: { |
| 34 "bar": { |
| 35 "bad": "bar" |
| 36 } |
| 37 })]).create(); |
| 38 |
| 39 d.appDir({ |
| 40 "foo": { |
| 41 "path": "../foo" |
| 42 } |
| 43 }).create(); |
| 44 |
| 45 pubCommand( |
| 46 command, |
| 47 error: 'Package foo depends on bar from unknown source "bad".'); |
| 48 }); |
| 49 |
| 50 integration('ignores unknown source in lockfile', () { |
| 51 d.dir('foo', [d.libDir('foo'), d.libPubspec('foo', '0.0.1')]).create(); |
| 52 |
| 53 // Depend on "foo" from a valid source. |
| 54 d.dir(appPath, [d.appPubspec({ |
| 55 "foo": { |
| 56 "path": "../foo" |
| 57 } |
| 58 })]).create(); |
| 59 |
| 60 // But lock it to a bad one. |
| 61 d.dir(appPath, [d.file("pubspec.lock", JSON.encode({ |
| 62 'packages': { |
| 63 'foo': { |
| 64 'version': '0.0.0', |
| 65 'source': 'bad', |
| 66 'description': { |
| 67 'name': 'foo' |
| 68 } |
| 69 } |
| 70 } |
| 71 }))]).create(); |
| 72 |
| 73 pubCommand(command); |
| 74 |
| 75 // Should upgrade to the new one. |
| 76 d.dir( |
| 77 packagesPath, |
| 78 [d.dir("foo", [d.file("foo.dart", 'main() => "foo";')])]).validate(); |
| 79 }); |
| 80 }); |
| 81 } |
OLD | NEW |