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

Unified Diff: test/lock_file_test.dart

Issue 2079303003: Track Source objects in PackageNames. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/validator/dependency.dart ('k') | test/pubspec_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/lock_file_test.dart
diff --git a/test/lock_file_test.dart b/test/lock_file_test.dart
index c59202e4424ac9b77aa699a0fb4ed30749e65123..ca6e0836156129bd064c675ad6e026b0349ff753 100644
--- a/test/lock_file_test.dart
+++ b/test/lock_file_test.dart
@@ -19,17 +19,19 @@ class MockSource extends Source {
PackageRef parseRef(String name, description, {String containingPath}) {
if (!description.endsWith(' desc')) throw new FormatException('Bad');
- return new PackageRef(name, this.name, description);
+ return new PackageRef(name, this, description);
}
PackageId parseId(String name, Version version, description) {
if (!description.endsWith(' desc')) throw new FormatException('Bad');
- return new PackageId(name, this.name, version, description);
+ return new PackageId(name, this, version, description);
}
bool descriptionsEqual(description1, description2) =>
description1 == description2;
+ int hashDescription(description) => description.hashCode;
+
String packageName(String description) {
// Strip off ' desc'.
return description.substring(0, description.length - 5);
@@ -71,13 +73,13 @@ packages:
var bar = lockFile.packages['bar'];
expect(bar.name, equals('bar'));
expect(bar.version, equals(new Version(1, 2, 3)));
- expect(bar.source, equals(mockSource.name));
+ expect(bar.source, equals(mockSource));
expect(bar.description, equals('bar desc'));
var foo = lockFile.packages['foo'];
expect(foo.name, equals('foo'));
expect(foo.version, equals(new Version(2, 3, 4)));
- expect(foo.source, equals(mockSource.name));
+ expect(foo.source, equals(mockSource));
expect(foo.description, equals('foo desc'));
});
@@ -90,7 +92,7 @@ packages:
description: foo desc
''', sources);
var foo = lockFile.packages['foo'];
- expect(foo.source, equals('bad'));
+ expect(foo.source, equals(sources['bad']));
});
test("allows an empty dependency map", () {
@@ -190,10 +192,9 @@ packages:
test('serialize() dumps the lockfile to YAML', () {
var lockfile = new LockFile([
new PackageId(
- 'foo', mockSource.name, new Version.parse('1.2.3'), 'foo desc'),
- new PackageId(
- 'bar', mockSource.name, new Version.parse('3.2.1'), 'bar desc')
- ], sources);
+ 'foo', mockSource, new Version.parse('1.2.3'), 'foo desc'),
+ new PackageId('bar', mockSource, new Version.parse('3.2.1'), 'bar desc')
+ ]);
expect(loadYaml(lockfile.serialize(null)), equals({
'sdk': 'any',
« no previous file with comments | « lib/src/validator/dependency.dart ('k') | test/pubspec_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698