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

Side by Side Diff: utils/tests/pub/sdk_constraint_test.dart

Issue 12092080: Validate packages against their SDK constraints. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up a bit. Created 7 years, 10 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
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5 library check_sdk_test;
6
7 import "test_pub.dart";
8 import "../../../pkg/unittest/lib/unittest.dart";
9
10 main() {
11 initConfig();
12
13 for (var command in ["install", "update"]) {
14 var success = "Dependencies installed!\$";
nweiz 2013/01/31 22:38:53 I'd make these RegExps, and use r""-style strings.
Bob Nystrom 2013/02/01 16:53:29 Done.
15 if (command == "update") {
16 success = "Dependencies updated!\$";
17 }
18
19 integration("gives a friendly message if there are no constraints", () {
20 dir(appPath, [
21 pubspec({"name": "myapp"}),
22 ]).scheduleCreate();
23
24 schedulePub(args: [command],
25 output: new RegExp(success));
26 });
27
28 integration("gives an error if the root package does not match", () {
29 dir(appPath, [
30 pubspec({
31 "name": "myapp",
32 "environment": {"sdk": ">2.0.0"}
33 })
34 ]).scheduleCreate();
35
36 schedulePub(args: [command],
37 error:
38 """
39 Some packages are not compatible with SDK version 0.1.2+3:
40 - 'myapp' requires >2.0.0
41
42 You may be able to resolve this by upgrading to the latest Dart SDK
43 or adding a version constraint to use an older version of a package.
44 """);
45 });
46
47 integration("gives an error if some dependencies do not match", () {
48 // Using an SDK source, but this should be true of all sources.
49 dir(sdkPath, [
50 dir("pkg", [
51 dir("foo", [
52 libPubspec("foo", "0.0.1", sdk: ">0.1.3"),
53 libDir("foo")
54 ]),
55 dir("bar", [
56 libPubspec("bar", "0.0.1", sdk: ">0.1.1"),
57 libDir("bar")
58 ])
59 ])
60 ]).scheduleCreate();
61
62 dir(appPath, [
63 pubspec({
64 "name": "myapp",
65 "dependencies": {
66 "foo": { "sdk": "foo" },
67 "bar": { "sdk": "bar" }
68 },
69 "environment": {"sdk": ">2.0.0"}
70 })
71 ]).scheduleCreate();
72
73 schedulePub(args: [command],
74 error:
75 """
76 Some packages are not compatible with SDK version 0.1.2+3:
77 - 'myapp' requires >2.0.0
78 - 'foo' requires >0.1.3
79
80 You may be able to resolve this by upgrading to the latest Dart SDK
81 or adding a version constraint to use an older version of a package.
82 """);
83 });
84
85 integration("gives an error if a transitive dependency doesn't match", () {
86 // Using an SDK source, but this should be true of all sources.
87 dir(sdkPath, [
88 dir("pkg", [
89 dir("foo", [
90 libPubspec("foo", "0.0.1", deps: [
91 {"sdk": "bar"}
92 ]),
93 libDir("foo")
94 ]),
95 dir("bar", [
96 libPubspec("bar", "0.0.1", sdk: "<0.1.1"),
97 libDir("bar")
98 ])
99 ])
100 ]).scheduleCreate();
101
102 dir(appPath, [
103 pubspec({
104 "name": "myapp",
105 "dependencies": {
106 "foo": { "sdk": "foo" }
107 }
108 })
109 ]).scheduleCreate();
110
111 schedulePub(args: [command],
112 error:
113 """
114 Some packages are not compatible with SDK version 0.1.2+3:
115 - 'bar' requires <0.1.1
116
117 You may be able to resolve this by upgrading to the latest Dart SDK
118 or adding a version constraint to use an older version of a package.
119 """);
120 });
121 }
122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698