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

Side by Side Diff: test/lock_file_test.dart

Issue 1528523003: Clean up the semantics of package descriptions. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 5 years 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
« no previous file with comments | « test/get/git/require_pubspec_test.dart ('k') | test/pubspec_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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'; 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'; 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<List<PackageId>> doGetVersions(PackageRef ref) =>
24 throw new UnsupportedError("Cannot get mock package versions.");
25
23 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError( 26 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError(
24 "Cannot describe mock packages."); 27 "Cannot describe mock packages.");
25 28
26 Future get(PackageId id, String symlink) => throw new UnsupportedError( 29 Future get(PackageId id, String symlink) => throw new UnsupportedError(
27 "Cannot get a mock package."); 30 "Cannot get a mock package.");
28 31
29 String getDirectory(PackageId id) => throw new UnsupportedError( 32 String getDirectory(PackageId id) => throw new UnsupportedError(
30 "Cannot get the directory for mock packages."); 33 "Cannot get the directory for mock packages.");
31 34
32 dynamic parseDescription(String filePath, String description, 35 PackageRef parseRef(String name, description, {String containingPath}) {
33 {bool fromLockFile: false}) { 36 if (!description.endsWith(' desc')) throw new FormatException('Bad');
34 if (!description.endsWith(' desc')) throw new FormatException(); 37 return new PackageRef(name, this.name, description);
35 return description; 38 }
39
40 PackageId parseId(String name, Version version, description) {
41 if (!description.endsWith(' desc')) throw new FormatException('Bad');
42 return new PackageId(name, this.name, version, description);
36 } 43 }
37 44
38 bool descriptionsEqual(description1, description2) => 45 bool descriptionsEqual(description1, description2) =>
39 description1 == description2; 46 description1 == description2;
40 47
41 String packageName(String description) { 48 String packageName(String description) {
42 // Strip off ' desc'. 49 // Strip off ' desc'.
43 return description.substring(0, description.length - 5); 50 return description.substring(0, description.length - 5);
44 } 51 }
45 } 52 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 'bar': { 220 'bar': {
214 'version': '3.2.1', 221 'version': '3.2.1',
215 'source': 'mock', 222 'source': 'mock',
216 'description': 'bar desc' 223 'description': 'bar desc'
217 } 224 }
218 } 225 }
219 })); 226 }));
220 }); 227 });
221 }); 228 });
222 } 229 }
OLDNEW
« no previous file with comments | « test/get/git/require_pubspec_test.dart ('k') | test/pubspec_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698