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

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: Created 7 years, 3 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
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
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 pkg.remove("author"); 107 pkg.remove("author");
92 pkg["authors"] = [ 108 pkg["authors"] = [
93 "Bob Nystrom <rnystrom@google.com>", 109 "Bob Nystrom <rnystrom@google.com>",
94 "<nweiz@google.com>", 110 "<nweiz@google.com>",
95 "John Messerly <jmesserly@google.com>" 111 "John Messerly <jmesserly@google.com>"
96 ]; 112 ];
97 d.dir(appPath, [d.pubspec(pkg)]).create(); 113 d.dir(appPath, [d.pubspec(pkg)]).create();
98 114
99 expectValidationWarning(pubspecField); 115 expectValidationWarning(pubspecField);
100 }); 116 });
117
118 integration('has a non-HTTP homepage URL', () {
119 var pkg = packageMap("test_pkg", "1.0.0");
120 pkg["homepage"] = "file:///foo/bar";
121 d.dir(appPath, [d.pubspec(pkg)]).create();
122
123 expectValidationError(pubspecField);
124 });
125
126 integration('has a non-HTTP documentation URL', () {
127 var pkg = packageMap("test_pkg", "1.0.0");
128 pkg["documentation"] = "file:///foo/bar";
129 d.dir(appPath, [d.pubspec(pkg)]).create();
130
131 expectValidationError(pubspecField);
132 });
101 }); 133 });
102 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698