Index: utils/tests/pub/validator_test.dart |
diff --git a/utils/tests/pub/validator_test.dart b/utils/tests/pub/validator_test.dart |
index bc4e30e4fa2f6662ff9ed229a460fbcb7ff074e3..b9eb6b7a4c8ca151879919b602f8d9ec73eea730 100644 |
--- a/utils/tests/pub/validator_test.dart |
+++ b/utils/tests/pub/validator_test.dart |
@@ -7,6 +7,7 @@ library validator_test; |
import 'dart:async'; |
import 'dart:io'; |
import 'dart:json' as json; |
+import 'dart:math' as math; |
import 'test_pub.dart'; |
import '../../../pkg/unittest/lib/unittest.dart'; |
@@ -22,6 +23,7 @@ import '../../pub/validator/lib.dart'; |
import '../../pub/validator/license.dart'; |
import '../../pub/validator/name.dart'; |
import '../../pub/validator/pubspec_field.dart'; |
+import '../../pub/validator/size.dart'; |
import '../../pub/validator/utf8_readme.dart'; |
void expectNoValidationError(ValidatorCreator fn) { |
@@ -54,6 +56,11 @@ Validator name(Entrypoint entrypoint) => new NameValidator(entrypoint); |
Validator pubspecField(Entrypoint entrypoint) => |
new PubspecFieldValidator(entrypoint); |
+Function size(int size) { |
+ return (entrypoint) => |
+ new SizeValidator(entrypoint, new Future.immediate(size)); |
+} |
+ |
Validator utf8Readme(Entrypoint entrypoint) => |
new Utf8ReadmeValidator(entrypoint); |
@@ -134,6 +141,11 @@ main() { |
expectNoValidationError(directory); |
}); |
+ integration('is <= 10 MB', () { |
+ expectNoValidationError(size(100)); |
+ expectNoValidationError(size(10 * math.pow(2, 20))); |
+ }); |
+ |
integration('has most but not all files from compiling dartdoc', () { |
dir(appPath, [ |
dir("doc-out", [ |
@@ -549,6 +561,10 @@ main() { |
} |
}); |
+ integration('is more than 10 MB', () { |
+ expectValidationError(size(10 * math.pow(2, 20) + 1)); |
+ }); |
+ |
test('contains compiled dartdoc', () { |
dir(appPath, [ |
dir('doc-out', [ |