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

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

Issue 24246002: Lazily throw pubspec parsing exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 2 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
« no previous file with comments | « sdk/lib/_internal/pub/test/update/git/update_to_nonexistent_pubspec_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
(...skipping 10 matching lines...) Expand all
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"', () {
26 var pkg = packageMap("test_pkg", "1.0.0"); 26 var pkg = packageMap("test_pkg", "1.0.0");
27 pkg["authors"] = [pkg.remove("author")]; 27 pkg["authors"] = [pkg.remove("author")];
28 d.dir(appPath, [d.pubspec(pkg)]).create(); 28 d.dir(appPath, [d.pubspec(pkg)]).create();
29 expectNoValidationError(pubspecField); 29 expectNoValidationError(pubspecField);
30 }); 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 });
31 }); 47 });
32 48
33 group('should consider a package invalid if it', () { 49 group('should consider a package invalid if it', () {
34 setUp(d.validPackage.create); 50 setUp(d.validPackage.create);
35 51
36 integration('is missing the "homepage" field', () { 52 integration('is missing the "homepage" field', () {
37 var pkg = packageMap("test_pkg", "1.0.0"); 53 var pkg = packageMap("test_pkg", "1.0.0");
38 pkg.remove("homepage"); 54 pkg.remove("homepage");
39 d.dir(appPath, [d.pubspec(pkg)]).create(); 55 d.dir(appPath, [d.pubspec(pkg)]).create();
40 56
41 expectValidationError(pubspecField); 57 expectValidationError(pubspecField);
42 }); 58 });
43 59
44 integration('is missing the "description" field', () { 60 integration('is missing the "description" field', () {
45 var pkg = packageMap("test_pkg", "1.0.0"); 61 var pkg = packageMap("test_pkg", "1.0.0");
46 pkg.remove("description"); 62 pkg.remove("description");
47 d.dir(appPath, [d.pubspec(pkg)]).create(); 63 d.dir(appPath, [d.pubspec(pkg)]).create();
48 64
49 expectValidationError(pubspecField); 65 expectValidationError(pubspecField);
50 }); 66 });
51 67
52 integration('is missing the "author" field', () { 68 integration('is missing the "author" field', () {
53 var pkg = packageMap("test_pkg", "1.0.0"); 69 var pkg = packageMap("test_pkg", "1.0.0");
54 pkg.remove("author"); 70 pkg.remove("author");
55 d.dir(appPath, [d.pubspec(pkg)]).create(); 71 d.dir(appPath, [d.pubspec(pkg)]).create();
56 72
57 expectValidationError(pubspecField); 73 expectValidationError(pubspecField);
58 }); 74 });
59 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
60 integration('has a single author without an email', () { 116 integration('has a single author without an email', () {
61 var pkg = packageMap("test_pkg", "1.0.0"); 117 var pkg = packageMap("test_pkg", "1.0.0");
62 pkg["author"] = "Nathan Weizenbaum"; 118 pkg["author"] = "Nathan Weizenbaum";
63 d.dir(appPath, [d.pubspec(pkg)]).create(); 119 d.dir(appPath, [d.pubspec(pkg)]).create();
64 120
65 expectValidationWarning(pubspecField); 121 expectValidationWarning(pubspecField);
66 }); 122 });
67 123
68 integration('has one of several authors without an email', () { 124 integration('has one of several authors without an email', () {
69 var pkg = packageMap("test_pkg", "1.0.0"); 125 var pkg = packageMap("test_pkg", "1.0.0");
(...skipping 21 matching lines...) Expand all
91 pkg.remove("author"); 147 pkg.remove("author");
92 pkg["authors"] = [ 148 pkg["authors"] = [
93 "Bob Nystrom <rnystrom@google.com>", 149 "Bob Nystrom <rnystrom@google.com>",
94 "<nweiz@google.com>", 150 "<nweiz@google.com>",
95 "John Messerly <jmesserly@google.com>" 151 "John Messerly <jmesserly@google.com>"
96 ]; 152 ];
97 d.dir(appPath, [d.pubspec(pkg)]).create(); 153 d.dir(appPath, [d.pubspec(pkg)]).create();
98 154
99 expectValidationWarning(pubspecField); 155 expectValidationWarning(pubspecField);
100 }); 156 });
157
158 integration('has a non-HTTP homepage URL', () {
159 var pkg = packageMap("test_pkg", "1.0.0");
160 pkg["homepage"] = "file:///foo/bar";
161 d.dir(appPath, [d.pubspec(pkg)]).create();
162
163 expectValidationError(pubspecField);
164 });
165
166 integration('has a non-HTTP documentation URL', () {
167 var pkg = packageMap("test_pkg", "1.0.0");
168 pkg["documentation"] = "file:///foo/bar";
169 d.dir(appPath, [d.pubspec(pkg)]).create();
170
171 expectValidationError(pubspecField);
172 });
101 }); 173 });
102 } 174 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/update/git/update_to_nonexistent_pubspec_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698