| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS 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 file. | |
| 4 | |
| 5 library pub_tests; | |
| 6 | |
| 7 import 'dart:io'; | |
| 8 | |
| 9 import 'package:scheduled_test/scheduled_test.dart'; | |
| 10 | |
| 11 import '../descriptor.dart' as d; | |
| 12 import '../test_pub.dart'; | |
| 13 | |
| 14 main() { | |
| 15 initConfig(); | |
| 16 group('requires', () { | |
| 17 integration('a pubspec', () { | |
| 18 d.dir(appPath, []).create(); | |
| 19 | |
| 20 schedulePub(args: ['update'], | |
| 21 error: new RegExp(r'^Could not find a file named "pubspec.yaml"'), | |
| 22 exitCode: 1); | |
| 23 }); | |
| 24 | |
| 25 integration('a pubspec with a "name" key', () { | |
| 26 d.dir(appPath, [ | |
| 27 d.pubspec({"dependencies": {"foo": null}}) | |
| 28 ]).create(); | |
| 29 | |
| 30 schedulePub(args: ['update'], | |
| 31 error: new RegExp(r'^pubspec.yaml is missing the required "name" ' | |
| 32 r'field \(e\.g\. "name: myapp"\)\.'), | |
| 33 exitCode: 1); | |
| 34 }); | |
| 35 }); | |
| 36 | |
| 37 integration('adds itself to the packages', () { | |
| 38 // The symlink should use the name in the pubspec, not the name of the | |
| 39 // directory. | |
| 40 d.dir(appPath, [ | |
| 41 d.pubspec({"name": "myapp_name"}), | |
| 42 d.libDir('myapp_name') | |
| 43 ]).create(); | |
| 44 | |
| 45 schedulePub(args: ['update'], | |
| 46 output: new RegExp(r"Dependencies updated!$")); | |
| 47 | |
| 48 d.dir(packagesPath, [ | |
| 49 d.dir("myapp_name", [ | |
| 50 d.file('myapp_name.dart', 'main() => "myapp_name";') | |
| 51 ]) | |
| 52 ]).validate(); | |
| 53 }); | |
| 54 | |
| 55 integration('does not adds itself to the packages if it has no "lib" ' | |
| 56 'directory', () { | |
| 57 // The symlink should use the name in the pubspec, not the name of the | |
| 58 // directory. | |
| 59 d.dir(appPath, [ | |
| 60 d.pubspec({"name": "myapp_name"}), | |
| 61 ]).create(); | |
| 62 | |
| 63 schedulePub(args: ['update'], | |
| 64 output: new RegExp(r"Dependencies updated!$")); | |
| 65 | |
| 66 d.dir(packagesPath, [ | |
| 67 d.nothing("myapp_name") | |
| 68 ]).validate(); | |
| 69 }); | |
| 70 | |
| 71 integration('does not add a package if it does not have a "lib" ' | |
| 72 'directory', () { | |
| 73 // Using a path source, but this should be true of all sources. | |
| 74 d.dir('foo', [ | |
| 75 d.libPubspec('foo', '0.0.0-not.used') | |
| 76 ]).create(); | |
| 77 | |
| 78 d.dir(appPath, [ | |
| 79 d.pubspec({"name": "myapp", "dependencies": {"foo": {"path": "../foo"}}}) | |
| 80 ]).create(); | |
| 81 | |
| 82 schedulePub(args: ['update'], | |
| 83 output: new RegExp(r"Dependencies updated!$")); | |
| 84 | |
| 85 d.packagesDir({"foo": null}).validate(); | |
| 86 }); | |
| 87 } | |
| OLD | NEW |