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

Side by Side Diff: sdk/lib/_internal/pub/test/lock_file_test.dart

Issue 243683002: Refactor Source. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise all the things. Created 6 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library lock_file_test; 5 library lock_file_test;
6 6
7 import 'dart:async';
8
7 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
8 import 'package:yaml/yaml.dart'; 10 import 'package:yaml/yaml.dart';
9 11
10 import '../lib/src/lock_file.dart'; 12 import '../lib/src/lock_file.dart';
11 import '../lib/src/package.dart'; 13 import '../lib/src/package.dart';
14 import '../lib/src/pubspec.dart';
12 import '../lib/src/source.dart'; 15 import '../lib/src/source.dart';
13 import '../lib/src/source_registry.dart'; 16 import '../lib/src/source_registry.dart';
14 import '../lib/src/version.dart'; 17 import '../lib/src/version.dart';
15 import 'test_pub.dart'; 18 import 'test_pub.dart';
16 19
17 class MockSource extends Source { 20 class MockSource extends Source {
18 final String name = 'mock'; 21 final String name = 'mock';
19 final bool shouldCache = false; 22
23 Future<Pubspec> onDescribe(PackageId id) => throw new UnsupportedError(
24 "Cannot describe mock packages.");
25
26 Future<bool> get(PackageId id, String path) => throw new UnsupportedError(
27 "Cannot get a mock package.");
28
29 Future<String> getDirectory(PackageId id) => throw new UnsupportedError(
30 "Cannot get the directory for mock packages.");
20 31
21 dynamic parseDescription(String filePath, String description, 32 dynamic parseDescription(String filePath, String description,
22 {bool fromLockFile: false}) { 33 {bool fromLockFile: false}) {
23 if (!description.endsWith(' desc')) throw new FormatException(); 34 if (!description.endsWith(' desc')) throw new FormatException();
24 return description; 35 return description;
25 } 36 }
26 37
38 bool descriptionsEqual(description1, description2) =>
39 description1 == description2;
40
27 String packageName(String description) { 41 String packageName(String description) {
28 // Strip off ' desc'. 42 // Strip off ' desc'.
29 return description.substring(0, description.length - 5); 43 return description.substring(0, description.length - 5);
30 } 44 }
31 } 45 }
32 46
33 main() { 47 main() {
34 initConfig(); 48 initConfig();
35 49
36 var sources = new SourceRegistry(); 50 var sources = new SourceRegistry();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 'version': '3.2.1', 204 'version': '3.2.1',
191 'source': 'mock', 205 'source': 'mock',
192 'description': 'bar desc' 206 'description': 'bar desc'
193 } 207 }
194 } 208 }
195 })); 209 }));
196 }); 210 });
197 }); 211 });
198 }); 212 });
199 } 213 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/system_cache.dart ('k') | sdk/lib/_internal/pub/test/pubspec_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698