OLD | NEW |
(Empty) | |
| 1 library pub_tests; |
| 2 import 'package:scheduled_test/scheduled_test.dart'; |
| 3 import '../lib/src/exit_codes.dart' as exit_codes; |
| 4 import 'descriptor.dart' as d; |
| 5 import 'test_pub.dart'; |
| 6 main() { |
| 7 initConfig(); |
| 8 forBothPubGetAndUpgrade((command) { |
| 9 group('requires', () { |
| 10 integration('a pubspec', () { |
| 11 d.dir(appPath, []).create(); |
| 12 pubCommand( |
| 13 command, |
| 14 error: new RegExp( |
| 15 r'Could not find a file named "pubspec.yaml" ' r'in "[^\n]*"\.')
); |
| 16 }); |
| 17 integration('a pubspec with a "name" key', () { |
| 18 d.dir(appPath, [d.pubspec({ |
| 19 "dependencies": { |
| 20 "foo": null |
| 21 } |
| 22 })]).create(); |
| 23 pubCommand( |
| 24 command, |
| 25 error: contains('Missing the required "name" field.'), |
| 26 exitCode: exit_codes.DATA); |
| 27 }); |
| 28 }); |
| 29 integration('adds itself to the packages', () { |
| 30 d.dir(appPath, [d.pubspec({ |
| 31 "name": "myapp_name" |
| 32 }), d.libDir('myapp_name')]).create(); |
| 33 pubCommand(command); |
| 34 d.dir( |
| 35 packagesPath, |
| 36 [ |
| 37 d.dir( |
| 38 "myapp_name", |
| 39 [d.file('myapp_name.dart', 'main() => "myapp_name";')])]).vali
date(); |
| 40 }); |
| 41 integration( |
| 42 'does not adds itself to the packages if it has no "lib" ' 'directory', |
| 43 () { |
| 44 d.dir(appPath, [d.pubspec({ |
| 45 "name": "myapp_name" |
| 46 })]).create(); |
| 47 pubCommand(command); |
| 48 d.dir(packagesPath, [d.nothing("myapp_name")]).validate(); |
| 49 }); |
| 50 integration( |
| 51 'does not add a package if it does not have a "lib" ' 'directory', |
| 52 () { |
| 53 d.dir('foo', [d.libPubspec('foo', '0.0.0-not.used')]).create(); |
| 54 d.dir(appPath, [d.appPubspec({ |
| 55 "foo": { |
| 56 "path": "../foo" |
| 57 } |
| 58 })]).create(); |
| 59 pubCommand(command); |
| 60 d.packagesDir({ |
| 61 "foo": null |
| 62 }).validate(); |
| 63 }); |
| 64 integration('reports a solver failure', () { |
| 65 d.dir('deps', [d.dir('foo', [d.pubspec({ |
| 66 "name": "foo", |
| 67 "dependencies": { |
| 68 "baz": { |
| 69 "path": "../baz1" |
| 70 } |
| 71 } |
| 72 })]), d.dir('bar', [d.pubspec({ |
| 73 "name": "bar", |
| 74 "dependencies": { |
| 75 "baz": { |
| 76 "path": "../baz2" |
| 77 } |
| 78 } |
| 79 })]), |
| 80 d.dir('baz1', [d.libPubspec('baz', '0.0.0')]), |
| 81 d.dir('baz2', [d.libPubspec('baz', '0.0.0')])]).create(); |
| 82 d.dir(appPath, [d.appPubspec({ |
| 83 "foo": { |
| 84 "path": "../deps/foo" |
| 85 }, |
| 86 "bar": { |
| 87 "path": "../deps/bar" |
| 88 } |
| 89 })]).create(); |
| 90 pubCommand( |
| 91 command, |
| 92 error: new RegExp("^Incompatible dependencies on baz:\n")); |
| 93 }); |
| 94 integration('does not allow a dependency on itself', () { |
| 95 d.dir(appPath, [d.appPubspec({ |
| 96 "myapp": { |
| 97 "path": "." |
| 98 } |
| 99 })]).create(); |
| 100 pubCommand( |
| 101 command, |
| 102 error: contains('A package may not list itself as a dependency.'), |
| 103 exitCode: exit_codes.DATA); |
| 104 }); |
| 105 integration('does not allow a dev dependency on itself', () { |
| 106 d.dir(appPath, [d.pubspec({ |
| 107 "name": "myapp", |
| 108 "dev_dependencies": { |
| 109 "myapp": { |
| 110 "path": "." |
| 111 } |
| 112 } |
| 113 })]).create(); |
| 114 pubCommand( |
| 115 command, |
| 116 error: contains('A package may not list itself as a dependency.'), |
| 117 exitCode: exit_codes.DATA); |
| 118 }); |
| 119 }); |
| 120 } |
OLD | NEW |