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

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

Issue 14449004: Clean up various ways we find paths in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 8 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 | « sdk/lib/_internal/pub/test/real_version_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub
6 /// tests are integration tests that stage some stuff on the file system, run 6 /// tests are integration tests that stage some stuff on the file system, run
7 /// pub, and then validate the results. This library provides an API to build 7 /// pub, and then validate the results. This library provides an API to build
8 /// tests like that. 8 /// tests like that.
9 library test_pub; 9 library test_pub;
10 10
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 currentSchedule.onComplete.schedule(() => deleteEntry(_sandboxDir), 265 currentSchedule.onComplete.schedule(() => deleteEntry(_sandboxDir),
266 'deleting the sandbox directory'); 266 'deleting the sandbox directory');
267 267
268 // Schedule the test. 268 // Schedule the test.
269 body(); 269 body();
270 }); 270 });
271 } 271 }
272 272
273 /// Get the path to the root "pub/test" directory containing the pub 273 /// Get the path to the root "pub/test" directory containing the pub
274 /// tests. 274 /// tests.
275 String get testDirectory { 275 String get testDirectory =>
276 var dir = new Options().script; 276 path.absolute(path.dirname(libraryPath('test_pub')));
277 while (path.basename(dir) != 'test') dir = path.dirname(dir);
278
279 return path.absolute(dir);
280 }
281 277
282 /// Schedules renaming (moving) the directory at [from] to [to], both of which 278 /// Schedules renaming (moving) the directory at [from] to [to], both of which
283 /// are assumed to be relative to [sandboxDir]. 279 /// are assumed to be relative to [sandboxDir].
284 void scheduleRename(String from, String to) { 280 void scheduleRename(String from, String to) {
285 schedule( 281 schedule(
286 () => renameDir( 282 () => renameDir(
287 path.join(sandboxDir, from), 283 path.join(sandboxDir, from),
288 path.join(sandboxDir, to)), 284 path.join(sandboxDir, to)),
289 'renaming $from to $to'); 285 'renaming $from to $to');
290 } 286 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 bool matches(item, MatchState matchState) { 626 bool matches(item, MatchState matchState) {
631 if (item is! Pair) return false; 627 if (item is! Pair) return false;
632 return _firstMatcher.matches(item.first, matchState) && 628 return _firstMatcher.matches(item.first, matchState) &&
633 _lastMatcher.matches(item.last, matchState); 629 _lastMatcher.matches(item.last, matchState);
634 } 630 }
635 631
636 Description describe(Description description) { 632 Description describe(Description description) {
637 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); 633 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]);
638 } 634 }
639 } 635 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/real_version_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698