Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: sdk/lib/_internal/pub_generated/test/validator/pubspec_field_test.dart

Issue 896623005: Use native async/await support in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:scheduled_test/scheduled_test.dart';
6
7 import '../../lib/src/entrypoint.dart';
8 import '../../lib/src/validator.dart';
9 import '../../lib/src/validator/pubspec_field.dart';
10 import '../descriptor.dart' as d;
11 import '../test_pub.dart';
12 import 'utils.dart';
13
14 Validator pubspecField(Entrypoint entrypoint) =>
15 new PubspecFieldValidator(entrypoint);
16
17 main() {
18 initConfig();
19
20 group('should consider a package valid if it', () {
21 setUp(d.validPackage.create);
22
23 integration('looks normal', () => expectNoValidationError(pubspecField));
24
25 integration('has "authors" instead of "author"', () {
26 var pkg = packageMap("test_pkg", "1.0.0");
27 pkg["authors"] = [pkg.remove("author")];
28 d.dir(appPath, [d.pubspec(pkg)]).create();
29 expectNoValidationError(pubspecField);
30 });
31
32 integration('has an HTTPS homepage URL', () {
33 var pkg = packageMap("test_pkg", "1.0.0");
34 pkg["homepage"] = "https://pub.dartlang.org";
35 d.dir(appPath, [d.pubspec(pkg)]).create();
36
37 expectNoValidationError(pubspecField);
38 });
39
40 integration('has an HTTPS documentation URL', () {
41 var pkg = packageMap("test_pkg", "1.0.0");
42 pkg["documentation"] = "https://pub.dartlang.org";
43 d.dir(appPath, [d.pubspec(pkg)]).create();
44
45 expectNoValidationError(pubspecField);
46 });
47 });
48
49 group('should consider a package invalid if it', () {
50 setUp(d.validPackage.create);
51
52 integration('is missing the "homepage" field', () {
53 var pkg = packageMap("test_pkg", "1.0.0");
54 pkg.remove("homepage");
55 d.dir(appPath, [d.pubspec(pkg)]).create();
56
57 expectValidationError(pubspecField);
58 });
59
60 integration('is missing the "description" field', () {
61 var pkg = packageMap("test_pkg", "1.0.0");
62 pkg.remove("description");
63 d.dir(appPath, [d.pubspec(pkg)]).create();
64
65 expectValidationError(pubspecField);
66 });
67
68 integration('is missing the "author" field', () {
69 var pkg = packageMap("test_pkg", "1.0.0");
70 pkg.remove("author");
71 d.dir(appPath, [d.pubspec(pkg)]).create();
72
73 expectValidationError(pubspecField);
74 });
75
76 integration('has a non-string "homepage" field', () {
77 var pkg = packageMap("test_pkg", "1.0.0");
78 pkg["homepage"] = 12;
79 d.dir(appPath, [d.pubspec(pkg)]).create();
80
81 expectValidationError(pubspecField);
82 });
83
84 integration('has a non-string "description" field', () {
85 var pkg = packageMap("test_pkg", "1.0.0");
86 pkg["description"] = 12;
87 d.dir(appPath, [d.pubspec(pkg)]).create();
88
89 expectValidationError(pubspecField);
90 });
91
92 integration('has a non-string "author" field', () {
93 var pkg = packageMap("test_pkg", "1.0.0");
94 pkg["author"] = 12;
95 d.dir(appPath, [d.pubspec(pkg)]).create();
96
97 expectValidationError(pubspecField);
98 });
99
100 integration('has a non-list "authors" field', () {
101 var pkg = packageMap("test_pkg", "1.0.0");
102 pkg["authors"] = 12;
103 d.dir(appPath, [d.pubspec(pkg)]).create();
104
105 expectValidationError(pubspecField);
106 });
107
108 integration('has a non-string member of the "authors" field', () {
109 var pkg = packageMap("test_pkg", "1.0.0");
110 pkg["authors"] = [12];
111 d.dir(appPath, [d.pubspec(pkg)]).create();
112
113 expectValidationError(pubspecField);
114 });
115
116 integration('has a single author without an email', () {
117 var pkg = packageMap("test_pkg", "1.0.0");
118 pkg["author"] = "Natalie Weizenbaum";
119 d.dir(appPath, [d.pubspec(pkg)]).create();
120
121 expectValidationWarning(pubspecField);
122 });
123
124 integration('has one of several authors without an email', () {
125 var pkg = packageMap("test_pkg", "1.0.0");
126 pkg.remove("author");
127 pkg["authors"] = [
128 "Bob Nystrom <rnystrom@google.com>",
129 "Natalie Weizenbaum",
130 "John Messerly <jmesserly@google.com>"];
131 d.dir(appPath, [d.pubspec(pkg)]).create();
132
133 expectValidationWarning(pubspecField);
134 });
135
136 integration('has a single author without a name', () {
137 var pkg = packageMap("test_pkg", "1.0.0");
138 pkg["author"] = "<nweiz@google.com>";
139 d.dir(appPath, [d.pubspec(pkg)]).create();
140
141 expectValidationWarning(pubspecField);
142 });
143
144 integration('has one of several authors without a name', () {
145 var pkg = packageMap("test_pkg", "1.0.0");
146 pkg.remove("author");
147 pkg["authors"] = [
148 "Bob Nystrom <rnystrom@google.com>",
149 "<nweiz@google.com>",
150 "John Messerly <jmesserly@google.com>"];
151 d.dir(appPath, [d.pubspec(pkg)]).create();
152
153 expectValidationWarning(pubspecField);
154 });
155
156 integration('has a non-HTTP homepage URL', () {
157 var pkg = packageMap("test_pkg", "1.0.0");
158 pkg["homepage"] = "file:///foo/bar";
159 d.dir(appPath, [d.pubspec(pkg)]).create();
160
161 expectValidationError(pubspecField);
162 });
163
164 integration('has a non-HTTP documentation URL', () {
165 var pkg = packageMap("test_pkg", "1.0.0");
166 pkg["documentation"] = "file:///foo/bar";
167 d.dir(appPath, [d.pubspec(pkg)]).create();
168
169 expectValidationError(pubspecField);
170 });
171 });
172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698