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

Side by Side Diff: utils/tests/pub/validator/size_test.dart

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added co19 issue number. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:math' as math; 6 import 'dart:math' as math;
7 7
8 import 'package:scheduled_test/scheduled_test.dart'; 8 import 'package:scheduled_test/scheduled_test.dart';
9 9
10 import '../../../pub/entrypoint.dart'; 10 import '../../../pub/entrypoint.dart';
11 import '../../../pub/validator.dart'; 11 import '../../../pub/validator.dart';
12 import '../../../pub/validator/size.dart'; 12 import '../../../pub/validator/size.dart';
13 import '../descriptor.dart' as d; 13 import '../descriptor.dart' as d;
14 import '../test_pub.dart'; 14 import '../test_pub.dart';
15 import 'utils.dart'; 15 import 'utils.dart';
16 16
17 Function size(int size) { 17 Function size(int size) {
18 return (entrypoint) => 18 return (entrypoint) =>
19 new SizeValidator(entrypoint, new Future.immediate(size)); 19 new SizeValidator(entrypoint, new Future.value(size));
20 } 20 }
21 21
22 main() { 22 main() {
23 initConfig(); 23 initConfig();
24 24
25 setUp(d.validPackage.create); 25 setUp(d.validPackage.create);
26 26
27 integration('should consider a package valid if it is <= 10 MB', () { 27 integration('should consider a package valid if it is <= 10 MB', () {
28 expectNoValidationError(size(100)); 28 expectNoValidationError(size(100));
29 expectNoValidationError(size(10 * math.pow(2, 20))); 29 expectNoValidationError(size(10 * math.pow(2, 20)));
30 }); 30 });
31 31
32 integration('should consider a package invalid if it is more than 10 MB', () { 32 integration('should consider a package invalid if it is more than 10 MB', () {
33 expectValidationError(size(10 * math.pow(2, 20) + 1)); 33 expectValidationError(size(10 * math.pow(2, 20) + 1));
34 }); 34 });
35 } 35 }
OLDNEW
« no previous file with comments | « utils/tests/pub/validator/dependency_test.dart ('k') | utils/tests/pub/version_solver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698