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

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

Issue 686323002: Add support for ^ constraints in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 1 month 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 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart'; 9 import 'package:http/testing.dart';
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 })); 50 }));
51 51
52 d.dir(appPath, [ 52 d.dir(appPath, [
53 d.libPubspec("test_pkg", "1.0.0", deps: {"foo": dep}) 53 d.libPubspec("test_pkg", "1.0.0", deps: {"foo": dep})
54 ]).create(); 54 ]).create();
55 } 55 }
56 56
57 main() { 57 main() {
58 initConfig(); 58 initConfig();
59 59
60 integration('should consider a package valid if it looks normal', () { 60 group('should consider a package valid if it', () {
61 d.validPackage.create(); 61 integration('looks normal', () {
62 expectNoValidationError(dependency); 62 d.validPackage.create();
63 expectNoValidationError(dependency);
64 });
65
66 integration('has a ^ constraint with an appropriate SDK constraint', () {
67 d.dir(appPath, [
68 d.libPubspec("test_pkg", "1.0.0", deps: {
69 "foo": "^1.2.3"
70 }, sdk: ">=1.8.0 <2.0.0")
71 ]).create();
72 expectNoValidationError(dependency);
73 });
63 }); 74 });
64 75
65 group('should consider a package invalid if it', () { 76 group('should consider a package invalid if it', () {
66 setUp(d.validPackage.create); 77 setUp(d.validPackage.create);
67 78
68 group('has a git dependency', () { 79 group('has a git dependency', () {
69 group('where a hosted version exists', () { 80 group('where a hosted version exists', () {
70 integration("and should suggest the hosted primary version", () { 81 integration("and should suggest the hosted primary version", () {
71 setUpDependency({'git': 'git://github.com/dart-lang/foo'}, 82 setUpDependency({'git': 'git://github.com/dart-lang/foo'},
72 hostedVersions: ["3.0.0-pre", "2.0.0", "1.0.0"]); 83 hostedVersions: ["3.0.0-pre", "2.0.0", "1.0.0"]);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 integration('and it should preserve the lower-bound operator', () { 384 integration('and it should preserve the lower-bound operator', () {
374 d.dir(appPath, [ 385 d.dir(appPath, [
375 d.libPubspec("test_pkg", "1.0.0", deps: { 386 d.libPubspec("test_pkg", "1.0.0", deps: {
376 "foo": ">1.2.3" 387 "foo": ">1.2.3"
377 }) 388 })
378 ]).create(); 389 ]).create();
379 390
380 expectDependencyValidationWarning(' foo: ">1.2.3 <2.0.0"'); 391 expectDependencyValidationWarning(' foo: ">1.2.3 <2.0.0"');
381 }); 392 });
382 }); 393 });
394
395 group('has a ^ dependency', () {
396 integration("without an SDK constraint", () {
397 d.dir(appPath, [
398 d.libPubspec("integration_pkg", "1.0.0", deps: {
399 "foo": "^1.2.3"
400 })
401 ]).create();
402
403 expectDependencyValidationError(' foo: ">=1.2.3 <2.0.0"');
404 });
405
406 integration("with a too-broad SDK constraint", () {
407 d.dir(appPath, [
408 d.libPubspec("test_pkg", "1.0.0", deps: {
409 "foo": "^1.2.3"
410 }, sdk: ">=1.5.0 <2.0.0")
411 ]).create();
412
413 expectDependencyValidationError(' foo: ">=1.2.3 <2.0.0"');
414 });
415 });
383 }); 416 });
384 } 417 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698