| 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:unittest/unittest.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'; | 18 import 'test_pub.dart'; |
| 19 | 19 |
| 20 class MockSource extends Source { | 20 class MockSource extends Source { |
| 21 final String name = 'mock'; | 21 final String name = 'mock'; |
| 22 | 22 |
| 23 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError( | 23 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError( |
| 24 "Cannot describe mock packages."); | 24 "Cannot describe mock packages."); |
| 25 | 25 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 bool descriptionsEqual(description1, description2) => | 38 bool descriptionsEqual(description1, description2) => |
| 39 description1 == description2; | 39 description1 == description2; |
| 40 | 40 |
| 41 String packageName(String description) { | 41 String packageName(String description) { |
| 42 // Strip off ' desc'. | 42 // Strip off ' desc'. |
| 43 return description.substring(0, description.length - 5); | 43 return description.substring(0, description.length - 5); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 main() { | 47 main() { |
| 48 initConfig(); | |
| 49 | |
| 50 var sources = new SourceRegistry(); | 48 var sources = new SourceRegistry(); |
| 51 var mockSource = new MockSource(); | 49 var mockSource = new MockSource(); |
| 52 sources.register(mockSource); | 50 sources.register(mockSource); |
| 53 | 51 |
| 54 group('LockFile', () { | 52 group('LockFile', () { |
| 55 group('parse()', () { | 53 group('parse()', () { |
| 56 test('returns an empty lockfile if the contents are empty', () { | 54 test('returns an empty lockfile if the contents are empty', () { |
| 57 var lockFile = new LockFile.parse('', sources); | 55 var lockFile = new LockFile.parse('', sources); |
| 58 expect(lockFile.packages.length, equals(0)); | 56 expect(lockFile.packages.length, equals(0)); |
| 59 }); | 57 }); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 'version': '3.2.1', | 218 'version': '3.2.1', |
| 221 'source': 'mock', | 219 'source': 'mock', |
| 222 'description': 'bar desc' | 220 'description': 'bar desc' |
| 223 } | 221 } |
| 224 } | 222 } |
| 225 })); | 223 })); |
| 226 }); | 224 }); |
| 227 }); | 225 }); |
| 228 }); | 226 }); |
| 229 } | 227 } |
| OLD | NEW |