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

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

Issue 74013007: Hook up dependency overrides to the rest of pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 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 side-by-side diff with in-line comments
Download patch
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 afc04684f7f6e62cad108187960e3cdfbc3930ad..70eba930bd35a1de1da7cea47ec7a7068c53041a 100644
--- a/sdk/lib/_internal/pub/test/pubspec_test.dart
+++ b/sdk/lib/_internal/pub/test/pubspec_test.dart
@@ -100,6 +100,29 @@ dev_dependencies:
expect(pubspec.devDependencies, isEmpty);
});
+ test("allows a version constraint for dependency overrides", () {
+ var pubspec = new Pubspec.parse('''
+dependency_overrides:
+ foo:
+ mock: ok
+ version: ">=1.2.3 <3.4.5"
+''', sources);
+
+ var foo = pubspec.dependencyOverrides[0];
+ expect(foo.name, equals('foo'));
+ expect(foo.constraint.allows(new Version(1, 2, 3)), isTrue);
+ expect(foo.constraint.allows(new Version(1, 2, 5)), isTrue);
+ expect(foo.constraint.allows(new Version(3, 4, 5)), isFalse);
+ });
+
+ test("allows an empty dependency overrides map", () {
+ var pubspec = new Pubspec.parse('''
+dependency_overrides:
+''', sources);
+
+ expect(pubspec.dependencyOverrides, isEmpty);
+ });
+
test("allows an unknown source", () {
var pubspec = new Pubspec.parse('''
dependencies:
@@ -143,6 +166,15 @@ dev_dependencies:
''', (pubspec) => pubspec.devDependencies);
});
+ test("throws if it has an override on itself", () {
+ expectPubspecException('''
+name: myapp
+dependency_overrides:
+ myapp:
+ mock: ok
+''', (pubspec) => pubspec.dependencyOverrides);
+ });
+
test("throws if the description isn't valid", () {
expectPubspecException('''
dependencies:

Powered by Google App Engine
This is Rietveld 408576698