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:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 import 'package:yaml/yaml.dart'; | 10 import 'package:yaml/yaml.dart'; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 expect(foo.source, equals('bad')); | 103 expect(foo.source, equals('bad')); |
104 }); | 104 }); |
105 | 105 |
106 test("allows an empty dependency map", () { | 106 test("allows an empty dependency map", () { |
107 var lockFile = new LockFile.parse(''' | 107 var lockFile = new LockFile.parse(''' |
108 packages: | 108 packages: |
109 ''', sources); | 109 ''', sources); |
110 expect(lockFile.packages, isEmpty); | 110 expect(lockFile.packages, isEmpty); |
111 }); | 111 }); |
112 | 112 |
| 113 test("throws if the top level is not a map", () { |
| 114 expect(() { |
| 115 new LockFile.parse(''' |
| 116 not a map |
| 117 ''', sources); |
| 118 }, throwsFormatException); |
| 119 }); |
| 120 |
| 121 test("throws if the contents of 'packages' is not a map", () { |
| 122 expect(() { |
| 123 new LockFile.parse(''' |
| 124 packages: not a map |
| 125 ''', sources); |
| 126 }, throwsFormatException); |
| 127 }); |
| 128 |
113 test("throws if the version is missing", () { | 129 test("throws if the version is missing", () { |
114 expect(() { | 130 expect(() { |
115 new LockFile.parse(''' | 131 new LockFile.parse(''' |
116 packages: | 132 packages: |
117 foo: | 133 foo: |
118 source: mock | 134 source: mock |
119 description: foo desc | 135 description: foo desc |
120 ''', sources); | 136 ''', sources); |
121 }, throwsFormatException); | 137 }, throwsFormatException); |
122 }); | 138 }); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 'version': '3.2.1', | 220 'version': '3.2.1', |
205 'source': 'mock', | 221 'source': 'mock', |
206 'description': 'bar desc' | 222 'description': 'bar desc' |
207 } | 223 } |
208 } | 224 } |
209 })); | 225 })); |
210 }); | 226 }); |
211 }); | 227 }); |
212 }); | 228 }); |
213 } | 229 } |
OLD | NEW |