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

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

Issue 10876058: Split pub tests into separate suites. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « no previous file | utils/tests/pub/pub_install_repo_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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('pub_tests');
6
7 #import('dart:io');
8
9 #import('test_pub.dart');
10 #import('../../../pkg/unittest/unittest.dart');
11
12 main() {
13 test('checks out a package from Git', () {
14 ensureGit();
15
16 git('foo.git', [
17 file('foo.dart', 'main() => "foo";')
18 ]).scheduleCreate();
19
20 appDir([{"git": "../foo.git"}]).scheduleCreate();
21
22 schedulePub(args: ['install'],
23 output: const RegExp(@"Dependencies installed!$"));
24
25 dir(cachePath, [
26 dir('git', [
27 dir('cache', [gitPackageCacheDir('foo')]),
28 gitPackageCacheDir('foo')
29 ])
30 ]).scheduleValidate();
31
32 dir(packagesPath, [
33 dir('foo', [
34 file('foo.dart', 'main() => "foo";')
35 ])
36 ]).scheduleValidate();
37
38 run();
39 });
40
41 test('checks out packages transitively from Git', () {
42 ensureGit();
43
44 git('foo.git', [
45 file('foo.dart', 'main() => "foo";'),
46 appPubspec([{"git": "../bar.git"}])
47 ]).scheduleCreate();
48
49 git('bar.git', [
50 file('bar.dart', 'main() => "bar";')
51 ]).scheduleCreate();
52
53 appDir([{"git": "../foo.git"}]).scheduleCreate();
54
55 schedulePub(args: ['install'],
56 output: const RegExp("Dependencies installed!\$"));
57
58 dir(cachePath, [
59 dir('git', [
60 dir('cache', [
61 gitPackageCacheDir('foo'),
62 gitPackageCacheDir('bar')
63 ]),
64 gitPackageCacheDir('foo'),
65 gitPackageCacheDir('bar')
66 ])
67 ]).scheduleValidate();
68
69 dir(packagesPath, [
70 dir('foo', [
71 file('foo.dart', 'main() => "foo";')
72 ]),
73 dir('bar', [
74 file('bar.dart', 'main() => "bar";')
75 ])
76 ]).scheduleValidate();
77
78 run();
79 });
80
81 test('checks out and updates a package from Git', () {
82 ensureGit();
83
84 git('foo.git', [
85 file('foo.dart', 'main() => "foo";')
86 ]).scheduleCreate();
87
88 appDir([{"git": "../foo.git"}]).scheduleCreate();
89
90 schedulePub(args: ['install'],
91 output: const RegExp(@"Dependencies installed!$"));
92
93 dir(cachePath, [
94 dir('git', [
95 dir('cache', [gitPackageCacheDir('foo')]),
96 gitPackageCacheDir('foo')
97 ])
98 ]).scheduleValidate();
99
100 dir(packagesPath, [
101 dir('foo', [
102 file('foo.dart', 'main() => "foo";')
103 ])
104 ]).scheduleValidate();
105
106 // TODO(nweiz): remove this once we support pub update
107 dir(packagesPath).scheduleDelete();
108 file('$appPath/pubspec.lock', '').scheduleDelete();
109
110 git('foo.git', [
111 file('foo.dart', 'main() => "foo 2";')
112 ]).scheduleCommit();
113
114 schedulePub(args: ['install'],
115 output: const RegExp(@"Dependencies installed!$"));
116
117 // When we download a new version of the git package, we should re-use the
118 // git/cache directory but create a new git/ directory.
119 dir(cachePath, [
120 dir('git', [
121 dir('cache', [gitPackageCacheDir('foo', 2)]),
122 gitPackageCacheDir('foo'),
123 gitPackageCacheDir('foo', 2)
124 ])
125 ]).scheduleValidate();
126
127 dir(packagesPath, [
128 dir('foo', [
129 file('foo.dart', 'main() => "foo 2";')
130 ])
131 ]).scheduleValidate();
132
133 run();
134 });
135
136 test('checks out a package from Git twice', () {
137 ensureGit();
138
139 git('foo.git', [
140 file('foo.dart', 'main() => "foo";')
141 ]).scheduleCreate();
142
143 appDir([{"git": "../foo.git"}]).scheduleCreate();
144
145 schedulePub(args: ['install'],
146 output: const RegExp(@"Dependencies installed!$"));
147
148 dir(cachePath, [
149 dir('git', [
150 dir('cache', [gitPackageCacheDir('foo')]),
151 gitPackageCacheDir('foo')
152 ])
153 ]).scheduleValidate();
154
155 dir(packagesPath, [
156 dir('foo', [
157 file('foo.dart', 'main() => "foo";')
158 ])
159 ]).scheduleValidate();
160
161 // TODO(nweiz): remove this once we support pub update
162 dir(packagesPath).scheduleDelete();
163
164 // Verify that nothing breaks if we install a Git revision that's already
165 // in the cache.
166 schedulePub(args: ['install'],
167 output: const RegExp(@"Dependencies installed!$"));
168
169 run();
170 });
171
172 test('checks out a package at a specific revision from Git', () {
173 ensureGit();
174
175 var repo = git('foo.git', [
176 file('foo.dart', 'main() => "foo 1";')
177 ]);
178 repo.scheduleCreate();
179 var commit = repo.revParse('HEAD');
180
181 git('foo.git', [
182 file('foo.dart', 'main() => "foo 2";')
183 ]).scheduleCommit();
184
185 appDir([{"git": {"url": "../foo.git", "ref": commit}}]).scheduleCreate();
186
187 schedulePub(args: ['install'],
188 output: const RegExp(@"Dependencies installed!$"));
189
190 dir(packagesPath, [
191 dir('foo', [
192 file('foo.dart', 'main() => "foo 1";')
193 ])
194 ]).scheduleValidate();
195
196 run();
197 });
198
199 test('keeps a Git package locked to the version in the lockfile', () {
200 ensureGit();
201
202 git('foo.git', [
203 file('foo.dart', 'main() => "foo";')
204 ]).scheduleCreate();
205
206 appDir([{"git": "../foo.git"}]).scheduleCreate();
207
208 // This install should lock the foo.git dependency to the current revision.
209 schedulePub(args: ['install'],
210 output: const RegExp(@"Dependencies installed!$"));
211
212 dir(packagesPath, [
213 dir('foo', [
214 file('foo.dart', 'main() => "foo";')
215 ])
216 ]).scheduleValidate();
217
218 // Delete the packages path to simulate a new checkout of the application.
219 dir(packagesPath).scheduleDelete();
220
221 git('foo.git', [
222 file('foo.dart', 'main() => "foo 2";')
223 ]).scheduleCommit();
224
225 // This install shouldn't update the foo.git dependency due to the lockfile.
226 schedulePub(args: ['install'],
227 output: const RegExp(@"Dependencies installed!$"));
228
229 dir(packagesPath, [
230 dir('foo', [
231 file('foo.dart', 'main() => "foo";')
232 ])
233 ]).scheduleValidate();
234
235 run();
236 });
237
238 test('updates a locked Git package with a new incompatible constraint', () {
239 ensureGit();
240
241 git('foo.git', [
242 file('foo.dart', 'main() => "foo";')
243 ]).scheduleCreate();
244
245 appDir([{"git": "../foo.git"}]).scheduleCreate();
246
247 schedulePub(args: ['install'],
248 output: const RegExp(@"Dependencies installed!$"));
249
250 dir(packagesPath, [
251 dir('foo', [
252 file('foo.dart', 'main() => "foo";')
253 ])
254 ]).scheduleValidate();
255
256 git('foo.git', [
257 file('foo.dart', 'main() => "foo 1.0.0";'),
258 libPubspec("foo", "1.0.0")
259 ]).scheduleCommit();
260
261 appDir([{"git": "../foo.git", "version": ">=1.0.0"}]).scheduleCreate();
262
263 schedulePub(args: ['install'],
264 output: const RegExp(@"Dependencies installed!$"));
265
266 dir(packagesPath, [
267 dir('foo', [
268 file('foo.dart', 'main() => "foo 1.0.0";')
269 ])
270 ]).scheduleValidate();
271
272 run();
273 });
274
275 test("doesn't update a locked Git package with a new compatible "
276 "constraint", () {
277 ensureGit();
278
279 git('foo.git', [
280 file('foo.dart', 'main() => "foo 1.0.0";'),
281 libPubspec("foo", "1.0.0")
282 ]).scheduleCreate();
283
284 appDir([{"git": "../foo.git"}]).scheduleCreate();
285
286 schedulePub(args: ['install'],
287 output: const RegExp(@"Dependencies installed!$"));
288
289 dir(packagesPath, [
290 dir('foo', [
291 file('foo.dart', 'main() => "foo 1.0.0";')
292 ])
293 ]).scheduleValidate();
294
295 git('foo.git', [
296 file('foo.dart', 'main() => "foo 1.0.1";'),
297 libPubspec("foo", "1.0.1")
298 ]).scheduleCommit();
299
300 appDir([{"git": "../foo.git", "version": ">=1.0.0"}]).scheduleCreate();
301
302 schedulePub(args: ['install'],
303 output: const RegExp(@"Dependencies installed!$"));
304
305 dir(packagesPath, [
306 dir('foo', [
307 file('foo.dart', 'main() => "foo 1.0.0";')
308 ])
309 ]).scheduleValidate();
310
311 run();
312 });
313 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/pub_install_repo_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698