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

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

Issue 11543006: Add a validator that checks that the lib directory is not empty. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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) 2012, the Dart project authors. Please see the AUTHORS file 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 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 /** 5 /**
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub
7 * tests are integration tests that stage some stuff on the file system, run 7 * tests are integration tests that stage some stuff on the file system, run
8 * pub, and then validate the results. This library provides an API to build 8 * pub, and then validate the results. This library provides an API to build
9 * tests like that. 9 * tests like that.
10 */ 10 */
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 ]) 215 ])
216 ]); 216 ]);
217 } 217 }
218 }); 218 });
219 }); 219 });
220 } 220 }
221 221
222 /** Converts [value] into a YAML string. */ 222 /** Converts [value] into a YAML string. */
223 String yaml(value) => JSON.stringify(value); 223 String yaml(value) => JSON.stringify(value);
224 224
225 /// Describes a package that passes all validation.
226 Descriptor get normalPackage => dir(appPath, [
227 libPubspec("test_pkg", "1.0.0"),
228 file("LICENSE", "Eh, do what you want."),
229 dir("lib", [
230 file("test_pkg.dart", "int i = 1;")
231 ])
232 ]);
233
225 /** 234 /**
226 * Describes a file named `pubspec.yaml` with the given YAML-serialized 235 * Describes a file named `pubspec.yaml` with the given YAML-serialized
227 * [contents], which should be a serializable object. 236 * [contents], which should be a serializable object.
228 * 237 *
229 * [contents] may contain [Future]s that resolve to serializable objects, which 238 * [contents] may contain [Future]s that resolve to serializable objects, which
230 * may in turn contain [Future]s recursively. 239 * may in turn contain [Future]s recursively.
231 */ 240 */
232 Descriptor pubspec(Map contents) { 241 Descriptor pubspec(Map contents) {
233 return async(_awaitObject(contents).transform((resolvedContents) => 242 return async(_awaitObject(contents).transform((resolvedContents) =>
234 file("pubspec.yaml", yaml(resolvedContents)))); 243 file("pubspec.yaml", yaml(resolvedContents))));
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 /// calling [completion] is unnecessary. 1641 /// calling [completion] is unnecessary.
1633 void expectLater(Future actual, matcher, {String reason, 1642 void expectLater(Future actual, matcher, {String reason,
1634 FailureHandler failureHandler, bool verbose: false}) { 1643 FailureHandler failureHandler, bool verbose: false}) {
1635 _schedule((_) { 1644 _schedule((_) {
1636 return actual.transform((value) { 1645 return actual.transform((value) {
1637 expect(value, matcher, reason: reason, failureHandler: failureHandler, 1646 expect(value, matcher, reason: reason, failureHandler: failureHandler,
1638 verbose: false); 1647 verbose: false);
1639 }); 1648 });
1640 }); 1649 });
1641 } 1650 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698