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 void validateDescription(String description, {bool fromLockFile: false}) { | 20 dynamic parseDescription(String filePath, String description, |
| 21 {bool fromLockFile: false}) { |
21 if (!description.endsWith(' desc')) throw new FormatException(); | 22 if (!description.endsWith(' desc')) throw new FormatException(); |
| 23 return description; |
22 } | 24 } |
23 | 25 |
24 String packageName(String description) { | 26 String packageName(String description) { |
25 // Strip off ' desc'. | 27 // Strip off ' desc'. |
26 return description.substring(0, description.length - 5); | 28 return description.substring(0, description.length - 5); |
27 } | 29 } |
28 } | 30 } |
29 | 31 |
30 main() { | 32 main() { |
31 var sources = new SourceRegistry(); | 33 var sources = new SourceRegistry(); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 'version': '3.2.1', | 176 'version': '3.2.1', |
175 'source': 'mock', | 177 'source': 'mock', |
176 'description': 'bar desc' | 178 'description': 'bar desc' |
177 } | 179 } |
178 } | 180 } |
179 })); | 181 })); |
180 }); | 182 }); |
181 }); | 183 }); |
182 }); | 184 }); |
183 } | 185 } |
OLD | NEW |