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