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

Unified Diff: utils/tests/pub/validator_test.dart

Issue 12094093: Add a validator that tests the size of pub packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« utils/pub/validator/size.dart ('K') | « utils/pub/validator/size.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 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', [
« utils/pub/validator/size.dart ('K') | « utils/pub/validator/size.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698