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

Side by Side Diff: test/lock_file_test.dart

Issue 1281043004: Make LockFile immutable. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
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';
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 packages: 188 packages:
189 foo: 189 foo:
190 bonus: not used 190 bonus: not used
191 version: 1.2.3 191 version: 1.2.3
192 source: mock 192 source: mock
193 description: foo desc 193 description: foo desc
194 ''', sources); 194 ''', sources);
195 }); 195 });
196 }); 196 });
197 197
198 group('serialize()', () { 198 test('serialize() dumps the lockfile to YAML', () {
199 var lockfile; 199 var lockfile = new LockFile([
200 setUp(() { 200 new PackageId(
201 lockfile = new LockFile.empty(); 201 'foo', mockSource.name, new Version.parse('1.2.3'), 'foo desc'),
202 }); 202 new PackageId(
203 'bar', mockSource.name, new Version.parse('3.2.1'), 'bar desc')
204 ], sources);
203 205
204 test('dumps the lockfile to YAML', () { 206 expect(loadYaml(lockfile.serialize(null, sources)), equals({
205 lockfile.packages['foo'] = new PackageId( 207 'packages': {
206 'foo', mockSource.name, new Version.parse('1.2.3'), 'foo desc'); 208 'foo': {
207 lockfile.packages['bar'] = new PackageId( 209 'version': '1.2.3',
208 'bar', mockSource.name, new Version.parse('3.2.1'), 'bar desc'); 210 'source': 'mock',
209 211 'description': 'foo desc'
210 expect(loadYaml(lockfile.serialize(null, sources)), equals({ 212 },
211 'packages': { 213 'bar': {
212 'foo': { 214 'version': '3.2.1',
213 'version': '1.2.3', 215 'source': 'mock',
214 'source': 'mock', 216 'description': 'bar desc'
215 'description': 'foo desc'
216 },
217 'bar': {
218 'version': '3.2.1',
219 'source': 'mock',
220 'description': 'bar desc'
221 }
222 } 217 }
223 })); 218 }
224 }); 219 }));
225 }); 220 });
226 }); 221 });
227 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698