| 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 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:pub/src/lock_file.dart'; | 9 import 'package:pub/src/lock_file.dart'; |
| 10 import 'package:pub/src/package.dart'; | 10 import 'package:pub/src/package.dart'; |
| 11 import 'package:pub/src/pubspec.dart'; | 11 import 'package:pub/src/pubspec.dart'; |
| 12 import 'package:pub/src/source.dart'; | 12 import 'package:pub/src/source.dart'; |
| 13 import 'package:pub/src/source_registry.dart'; | 13 import 'package:pub/src/source_registry.dart'; |
| 14 import 'package:pub_semver/pub_semver.dart'; | 14 import 'package:pub_semver/pub_semver.dart'; |
| 15 import 'package:test/test.dart'; | 15 import 'package:test/test.dart'; |
| 16 import 'package:yaml/yaml.dart'; | 16 import 'package:yaml/yaml.dart'; |
| 17 | 17 |
| 18 import 'test_pub.dart'; | |
| 19 | |
| 20 class MockSource extends Source { | 18 class MockSource extends Source { |
| 21 final String name = 'mock'; | 19 final String name = 'mock'; |
| 22 | 20 |
| 23 Future<List<PackageId>> doGetVersions(PackageRef ref) => | 21 Future<List<PackageId>> doGetVersions(PackageRef ref) => |
| 24 throw new UnsupportedError("Cannot get mock package versions."); | 22 throw new UnsupportedError("Cannot get mock package versions."); |
| 25 | 23 |
| 26 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError( | 24 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError( |
| 27 "Cannot describe mock packages."); | 25 "Cannot describe mock packages."); |
| 28 | 26 |
| 29 Future get(PackageId id, String symlink) => throw new UnsupportedError( | 27 Future get(PackageId id, String symlink) => throw new UnsupportedError( |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 packages: | 180 packages: |
| 183 foo: | 181 foo: |
| 184 version: 1.2.3 | 182 version: 1.2.3 |
| 185 source: mock | 183 source: mock |
| 186 description: foo desc is bad | 184 description: foo desc is bad |
| 187 ''', sources); | 185 ''', sources); |
| 188 }, throwsFormatException); | 186 }, throwsFormatException); |
| 189 }); | 187 }); |
| 190 | 188 |
| 191 test("ignores extra stuff in file", () { | 189 test("ignores extra stuff in file", () { |
| 192 var lockFile = new LockFile.parse(''' | 190 new LockFile.parse(''' |
| 193 extra: | 191 extra: |
| 194 some: stuff | 192 some: stuff |
| 195 packages: | 193 packages: |
| 196 foo: | 194 foo: |
| 197 bonus: not used | 195 bonus: not used |
| 198 version: 1.2.3 | 196 version: 1.2.3 |
| 199 source: mock | 197 source: mock |
| 200 description: foo desc | 198 description: foo desc |
| 201 ''', sources); | 199 ''', sources); |
| 202 }); | 200 }); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 220 'bar': { | 218 'bar': { |
| 221 'version': '3.2.1', | 219 'version': '3.2.1', |
| 222 'source': 'mock', | 220 'source': 'mock', |
| 223 'description': 'bar desc' | 221 'description': 'bar desc' |
| 224 } | 222 } |
| 225 } | 223 } |
| 226 })); | 224 })); |
| 227 }); | 225 }); |
| 228 }); | 226 }); |
| 229 } | 227 } |
| OLD | NEW |