OLD | NEW |
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 '../../../pkg/unittest/lib/unittest.dart'; | 7 import '../../../pkg/unittest/lib/unittest.dart'; |
8 import '../../../pkg/yaml/lib/yaml.dart'; | 8 import '../../../pkg/yaml/lib/yaml.dart'; |
9 import '../../pub/lock_file.dart'; | 9 import '../../pub/lock_file.dart'; |
10 import '../../pub/package.dart'; | 10 import '../../pub/package.dart'; |
11 import '../../pub/source.dart'; | 11 import '../../pub/source.dart'; |
12 import '../../pub/source_registry.dart'; | 12 import '../../pub/source_registry.dart'; |
13 import '../../pub/utils.dart'; | 13 import '../../pub/utils.dart'; |
14 import '../../pub/version.dart'; | 14 import '../../pub/version.dart'; |
15 | 15 |
16 class MockSource extends Source { | 16 class MockSource extends Source { |
17 final String name = 'mock'; | 17 final String name = 'mock'; |
18 final bool shouldCache = false; | 18 final bool shouldCache = false; |
19 | 19 |
20 dynamic parseDescription(String filePath, String description, | 20 void validateDescription(String description, {bool fromLockFile: false}) { |
21 {bool fromLockFile: false}) { | |
22 if (!description.endsWith(' desc')) throw new FormatException(); | 21 if (!description.endsWith(' desc')) throw new FormatException(); |
23 return description; | |
24 } | 22 } |
25 | 23 |
26 String packageName(String description) { | 24 String packageName(String description) { |
27 // Strip off ' desc'. | 25 // Strip off ' desc'. |
28 return description.substring(0, description.length - 5); | 26 return description.substring(0, description.length - 5); |
29 } | 27 } |
30 } | 28 } |
31 | 29 |
32 main() { | 30 main() { |
33 var sources = new SourceRegistry(); | 31 var sources = new SourceRegistry(); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 'version': '3.2.1', | 174 'version': '3.2.1', |
177 'source': 'mock', | 175 'source': 'mock', |
178 'description': 'bar desc' | 176 'description': 'bar desc' |
179 } | 177 } |
180 } | 178 } |
181 })); | 179 })); |
182 }); | 180 }); |
183 }); | 181 }); |
184 }); | 182 }); |
185 } | 183 } |
OLD | NEW |