Skip to content

Commit dd53e6e

Browse files
committed
style changes
1 parent aef8ffa commit dd53e6e

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

lib/src/validator/size.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'dart:async';
66
import 'dart:math' as math;
77

88
import '../entrypoint.dart';
9-
import '../io.dart' as io;
9+
import '../io.dart';
1010
import '../validator.dart';
1111

1212
/// The maximum size of the package to upload (100 MB).
@@ -23,7 +23,7 @@ class SizeValidator extends Validator {
2323
if (size <= _MAX_SIZE) return;
2424
var sizeInMb = (size / math.pow(2, 20)).toStringAsPrecision(4);
2525
// Current implementation of Package.listFiles skips hidden files
26-
var ignoreExists = io.fileExists(entrypoint.root.path('.gitignore'));
26+
var ignoreExists = fileExists(entrypoint.root.path('.gitignore'));
2727

2828
var error = new StringBuffer("Your package is $sizeInMb MB. Hosted "
2929
"packages must be smaller than 100 MB.");

test/validator/size_test.dart

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ ValidatorCreator size(int size) {
1717
return (entrypoint) => new SizeValidator(entrypoint, new Future.value(size));
1818
}
1919

20-
expectSizeValidationError(ValidatorCreator fn, Matcher matcher) {
21-
expect(validatePackage(fn), completion(pairOf(contains(matcher), anything)));
20+
expectSizeValidationError(Matcher matcher) {
21+
expect(validatePackage(size(100 * math.pow(2, 20) + 1)),
22+
completion(pairOf(contains(matcher), anything)));
2223
}
2324

2425
main() {
@@ -35,7 +36,6 @@ main() {
3536
await d.validPackage.create();
3637

3738
expectSizeValidationError(
38-
size(100 * math.pow(2, 20) + 1),
3939
equals("Your package is 100.0 MB. Hosted packages must "
4040
"be smaller than 100 MB."));
4141
});
@@ -44,32 +44,27 @@ main() {
4444
await d.validPackage.create();
4545
await d.dir(appPath, [d.file('.gitignore', 'ignored')]).create();
4646

47-
expectSizeValidationError(
48-
size(100 * math.pow(2, 20) + 1),
49-
allOf(
50-
contains("Hosted packages must be smaller than 100 MB."),
51-
contains("Your .gitignore has no effect since your project "
52-
"does not appear to be in version control.")));
47+
expectSizeValidationError(allOf(
48+
contains("Hosted packages must be smaller than 100 MB."),
49+
contains("Your .gitignore has no effect since your project "
50+
"does not appear to be in version control.")));
5351
});
5452

5553
test('package is under source control and no .gitignore exists', () async {
5654
await d.validPackage.create();
5755
await d.git(appPath).create();
5856

59-
expectSizeValidationError(
60-
size(100 * math.pow(2, 20) + 1),
61-
allOf(
62-
contains("Hosted packages must be smaller than 100 MB."),
63-
contains("Consider adding a .gitignore to avoid including "
64-
"temporary files.")));
57+
expectSizeValidationError(allOf(
58+
contains("Hosted packages must be smaller than 100 MB."),
59+
contains("Consider adding a .gitignore to avoid including "
60+
"temporary files.")));
6561
});
6662

6763
test('package is under source control and .gitignore exists', () async {
6864
await d.validPackage.create();
6965
await d.git(appPath, [d.file('.gitignore', 'ignored')]).create();
7066

7167
expectSizeValidationError(
72-
size(100 * math.pow(2, 20) + 1),
7368
equals("Your package is 100.0 MB. Hosted packages must "
7469
"be smaller than 100 MB."));
7570
});

0 commit comments

Comments
 (0)