| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'package:scheduled_test/scheduled_test.dart'; | 5 import 'package:scheduled_test/scheduled_test.dart'; |
| 6 | 6 |
| 7 import '../../lib/src/entrypoint.dart'; | 7 import '../../lib/src/entrypoint.dart'; |
| 8 import '../../lib/src/validator.dart'; | 8 import '../../lib/src/validator.dart'; |
| 9 import '../../lib/src/validator/pubspec_field.dart'; | 9 import '../../lib/src/validator/pubspec_field.dart'; |
| 10 import '../descriptor.dart' as d; | 10 import '../descriptor.dart' as d; |
| 11 import '../test_pub.dart'; | 11 import '../test_pub.dart'; |
| 12 import 'utils.dart'; | 12 import 'utils.dart'; |
| 13 | 13 |
| 14 Validator pubspecField(Entrypoint entrypoint) => | 14 Validator pubspecField(Entrypoint entrypoint) => |
| 15 new PubspecFieldValidator(entrypoint); | 15 new PubspecFieldValidator(entrypoint); |
| 16 | 16 |
| 17 main() { | 17 main() { |
| 18 initConfig(); | 18 initConfig(); |
| 19 | 19 |
| 20 group('should consider a package valid if it', () { | 20 group('should consider a package valid if it', () { |
| 21 setUp(d.validPackage.create); | 21 setUp(d.validPackage.create); |
| 22 | 22 |
| 23 integration('looks normal', () => expectNoValidationError(pubspecField)); | 23 integration('looks normal', () => expectNoValidationError(pubspecField)); |
| 24 | 24 |
| 25 integration('has "authors" instead of "author"', () { | 25 integration('has "authors" instead of "author"', () { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 pkg["author"] = "Natalie Weizenbaum"; | 118 pkg["author"] = "Natalie Weizenbaum"; |
| 119 d.dir(appPath, [d.pubspec(pkg)]).create(); | 119 d.dir(appPath, [d.pubspec(pkg)]).create(); |
| 120 | 120 |
| 121 expectValidationWarning(pubspecField); | 121 expectValidationWarning(pubspecField); |
| 122 }); | 122 }); |
| 123 | 123 |
| 124 integration('has one of several authors without an email', () { | 124 integration('has one of several authors without an email', () { |
| 125 var pkg = packageMap("test_pkg", "1.0.0"); | 125 var pkg = packageMap("test_pkg", "1.0.0"); |
| 126 pkg.remove("author"); | 126 pkg.remove("author"); |
| 127 pkg["authors"] = [ | 127 pkg["authors"] = [ |
| 128 "Bob Nystrom <rnystrom@google.com>", | 128 "Bob Nystrom <rnystrom@google.com>", |
| 129 "Natalie Weizenbaum", | 129 "Natalie Weizenbaum", |
| 130 "John Messerly <jmesserly@google.com>" | 130 "John Messerly <jmesserly@google.com>"]; |
| 131 ]; | |
| 132 d.dir(appPath, [d.pubspec(pkg)]).create(); | 131 d.dir(appPath, [d.pubspec(pkg)]).create(); |
| 133 | 132 |
| 134 expectValidationWarning(pubspecField); | 133 expectValidationWarning(pubspecField); |
| 135 }); | 134 }); |
| 136 | 135 |
| 137 integration('has a single author without a name', () { | 136 integration('has a single author without a name', () { |
| 138 var pkg = packageMap("test_pkg", "1.0.0"); | 137 var pkg = packageMap("test_pkg", "1.0.0"); |
| 139 pkg["author"] = "<nweiz@google.com>"; | 138 pkg["author"] = "<nweiz@google.com>"; |
| 140 d.dir(appPath, [d.pubspec(pkg)]).create(); | 139 d.dir(appPath, [d.pubspec(pkg)]).create(); |
| 141 | 140 |
| 142 expectValidationWarning(pubspecField); | 141 expectValidationWarning(pubspecField); |
| 143 }); | 142 }); |
| 144 | 143 |
| 145 integration('has one of several authors without a name', () { | 144 integration('has one of several authors without a name', () { |
| 146 var pkg = packageMap("test_pkg", "1.0.0"); | 145 var pkg = packageMap("test_pkg", "1.0.0"); |
| 147 pkg.remove("author"); | 146 pkg.remove("author"); |
| 148 pkg["authors"] = [ | 147 pkg["authors"] = [ |
| 149 "Bob Nystrom <rnystrom@google.com>", | 148 "Bob Nystrom <rnystrom@google.com>", |
| 150 "<nweiz@google.com>", | 149 "<nweiz@google.com>", |
| 151 "John Messerly <jmesserly@google.com>" | 150 "John Messerly <jmesserly@google.com>"]; |
| 152 ]; | |
| 153 d.dir(appPath, [d.pubspec(pkg)]).create(); | 151 d.dir(appPath, [d.pubspec(pkg)]).create(); |
| 154 | 152 |
| 155 expectValidationWarning(pubspecField); | 153 expectValidationWarning(pubspecField); |
| 156 }); | 154 }); |
| 157 | 155 |
| 158 integration('has a non-HTTP homepage URL', () { | 156 integration('has a non-HTTP homepage URL', () { |
| 159 var pkg = packageMap("test_pkg", "1.0.0"); | 157 var pkg = packageMap("test_pkg", "1.0.0"); |
| 160 pkg["homepage"] = "file:///foo/bar"; | 158 pkg["homepage"] = "file:///foo/bar"; |
| 161 d.dir(appPath, [d.pubspec(pkg)]).create(); | 159 d.dir(appPath, [d.pubspec(pkg)]).create(); |
| 162 | 160 |
| 163 expectValidationError(pubspecField); | 161 expectValidationError(pubspecField); |
| 164 }); | 162 }); |
| 165 | 163 |
| 166 integration('has a non-HTTP documentation URL', () { | 164 integration('has a non-HTTP documentation URL', () { |
| 167 var pkg = packageMap("test_pkg", "1.0.0"); | 165 var pkg = packageMap("test_pkg", "1.0.0"); |
| 168 pkg["documentation"] = "file:///foo/bar"; | 166 pkg["documentation"] = "file:///foo/bar"; |
| 169 d.dir(appPath, [d.pubspec(pkg)]).create(); | 167 d.dir(appPath, [d.pubspec(pkg)]).create(); |
| 170 | 168 |
| 171 expectValidationError(pubspecField); | 169 expectValidationError(pubspecField); |
| 172 }); | 170 }); |
| 173 }); | 171 }); |
| 174 } | 172 } |
| OLD | NEW |