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 '../../../pkg/unittest/lib/unittest.dart'; | 7 import '../../../pkg/unittest/lib/unittest.dart'; |
8 import '../../../pkg/yaml/lib/yaml.dart'; | 8 import '../../../pkg/yaml/lib/yaml.dart'; |
9 import '../../pub/lock_file.dart'; | 9 import '../../pub/lock_file.dart'; |
10 import '../../pub/package.dart'; | 10 import '../../pub/package.dart'; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 }); | 155 }); |
156 }); | 156 }); |
157 | 157 |
158 group('serialize()', () { | 158 group('serialize()', () { |
159 test('dumps the lockfile to YAML', () { | 159 test('dumps the lockfile to YAML', () { |
160 var lockfile = new LockFile.empty(); | 160 var lockfile = new LockFile.empty(); |
161 lockfile.packages['foo'] = new PackageId( | 161 lockfile.packages['foo'] = new PackageId( |
162 'foo', mockSource, new Version.parse('1.2.3'), 'foo desc'); | 162 'foo', mockSource, new Version.parse('1.2.3'), 'foo desc'); |
163 lockfile.packages['bar'] = new PackageId( | 163 lockfile.packages['bar'] = new PackageId( |
164 'foo', mockSource, new Version.parse('3.2.1'), 'bar desc'); | 164 'foo', mockSource, new Version.parse('3.2.1'), 'bar desc'); |
165 | 165 |
166 expect(loadYaml(lockfile.serialize()), equals({ | 166 expect(loadYaml(lockfile.serialize().replaceAll(LockFile.comment, '')), equals({ |
Bob Nystrom
2013/01/31 22:17:44
This shouldn't be needed. If it is, there's a bug
keertip
2013/01/31 22:23:39
If the comment is not removed, loadYaml fails and
keertip
2013/01/31 22:31:40
Guess that was because the comment should be on a
Bob Nystrom
2013/01/31 22:33:48
That was my hunch too. :)
| |
167 'packages': { | 167 'packages': { |
168 'foo': { | 168 'foo': { |
169 'version': '1.2.3', | 169 'version': '1.2.3', |
170 'source': 'mock', | 170 'source': 'mock', |
171 'description': 'foo desc' | 171 'description': 'foo desc' |
172 }, | 172 }, |
173 'bar': { | 173 'bar': { |
174 'version': '3.2.1', | 174 'version': '3.2.1', |
175 'source': 'mock', | 175 'source': 'mock', |
176 'description': 'bar desc' | 176 'description': 'bar desc' |
177 } | 177 } |
178 } | 178 } |
179 })); | 179 })); |
180 }); | 180 }); |
181 }); | 181 }); |
182 }); | 182 }); |
183 } | 183 } |
OLD | NEW |