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

Unified Diff: sdk/lib/_internal/pub/test/pubspec_test.dart

Issue 23295025: Handle invalid version syntax in pubspecs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Refactor a bit. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/pubspec.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/test/pubspec_test.dart
diff --git a/sdk/lib/_internal/pub/test/pubspec_test.dart b/sdk/lib/_internal/pub/test/pubspec_test.dart
index 47f838a0a7f2fb895a1e9e4f8ac3ce7e6c6748bf..e7608b4cfc375908fd99a6d71b58439d4ac6c997 100644
--- a/sdk/lib/_internal/pub/test/pubspec_test.dart
+++ b/sdk/lib/_internal/pub/test/pubspec_test.dart
@@ -111,10 +111,40 @@ dependencies:
''');
});
+ test("throws if dependency version is not a string", () {
+ expectFormatError('''
+dependencies:
+ foo:
+ mock: ok
+ version: 1.2
+''');
+ });
+
+ test("throws if version is not a version constraint", () {
+ expectFormatError('''
+dependencies:
+ foo:
+ mock: ok
+ version: not constraint
+''');
+ });
+
test("throws if 'name' is not a string", () {
expectFormatError('name: [not, a, string]');
});
+ test("throws if version is not a string", () {
+ expectFormatError('''
+version: 1.0
+''');
+ });
+
+ test("throws if version is not a version", () {
+ expectFormatError('''
+version: not version
+''');
+ });
+
test("throws if 'homepage' is not a string", () {
expectFormatError('homepage:');
expectFormatError('homepage: [not, a, string]');
@@ -212,6 +242,13 @@ environment:
''');
});
+ test("throws if the sdk is not a string", () {
+ expectFormatError('''
+environment:
+ sdk: 1.0
+''');
+ });
+
test("throws if the sdk isn't a valid version constraint", () {
expectFormatError('''
environment:
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/pubspec.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698