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

Unified Diff: utils/tests/pub/validator_test.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 side-by-side diff with in-line comments
Download patch
« utils/pub/validator/lib.dart ('K') | « utils/tests/pub/test_pub.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/validator_test.dart
diff --git a/utils/tests/pub/validator_test.dart b/utils/tests/pub/validator_test.dart
index e5005bfb9627f7dccfef0c127c0cec3cad8b905b..d9877eb45de9c678b220df0939f5f386b3590d78 100644
--- a/utils/tests/pub/validator_test.dart
+++ b/utils/tests/pub/validator_test.dart
@@ -12,6 +12,7 @@ import '../../../pkg/unittest/lib/unittest.dart';
import '../../pub/entrypoint.dart';
import '../../pub/io.dart';
import '../../pub/validator.dart';
+import '../../pub/validator/lib.dart';
import '../../pub/validator/license.dart';
import '../../pub/validator/name.dart';
import '../../pub/validator/pubspec_field.dart';
@@ -28,19 +29,16 @@ void expectValidationWarning(ValidatorCreator fn) {
expectLater(schedulePackageValidation(fn), pairOf(isEmpty, isNot(isEmpty)));
}
-Validator pubspecField(Entrypoint entrypoint) =>
- new PubspecFieldValidator(entrypoint);
+Validator lib(Entrypoint entrypoint) => new LibValidator(entrypoint);
Validator license(Entrypoint entrypoint) => new LicenseValidator(entrypoint);
Validator name(Entrypoint entrypoint) => new NameValidator(entrypoint);
-void scheduleNormalPackage() {
- dir(appPath, [
- libPubspec("test_pkg", "1.0.0"),
- file("LICENSE", "Eh, do what you want.")
- ]).scheduleCreate();
-}
+Validator pubspecField(Entrypoint entrypoint) =>
+ new PubspecFieldValidator(entrypoint);
+
+void scheduleNormalPackage() => normalPackage.scheduleCreate();
main() {
group('should consider a package valid if it', () {
@@ -93,6 +91,17 @@ main() {
expectNoValidationError(name);
run();
});
+
+ test('has a non-Dart file in lib', () {
+ dir(appPath, [
+ libPubspec("test_pkg", "1.0.0"),
+ dir("lib", [
+ file("thing.txt", "woo hoo")
+ ])
+ ]).scheduleCreate();
+ expectNoValidationError(lib);
+ run();
+ });
});
group('should consider a package invalid if it', () {
@@ -242,5 +251,28 @@ main() {
expectValidationError(name);
run();
});
+
+ test('has no lib directory', () {
+ dir(join(appPath, "lib")).scheduleDelete();
+ expectValidationError(lib);
+ run();
+ });
+
+ test('has an empty lib directory', () {
+ file(join(appPath, "lib", "test_pkg.dart"), '').scheduleDelete();
+ expectValidationError(lib);
+ run();
+ });
+
+ test('has a lib directory containing only src', () {
+ file(join(appPath, "lib", "test_pkg.dart"), '').scheduleDelete();
+ dir(appPath, [
+ dir("lib", [
+ dir("src", [file("test_pkg.dart", "int i = 0;")])
+ ])
+ ]).scheduleCreate();
+ expectValidationError(lib);
+ run();
+ });
});
}
« utils/pub/validator/lib.dart ('K') | « utils/tests/pub/test_pub.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698